Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Outlook 2 parts

Status
Not open for further replies.

adamroof

Programmer
Nov 5, 2003
1,107
US
I have this code that works fine, but Part 1 question is it pops up when OL2000 is open saying an app is trying to send on your behalf an i have to wait 30 seconds to click Yes. How can i stop that? I have used the sendObject and set true to edit which is fine, but i would like to send without any editing or 30 sec warnings.
***
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

'**creates an instance of Outlook
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "me@myemail.com"
.Subject = strSubject
.Body = strBody
.Send
End With
(i've declared variables elsewhere, it works fine too much to copy paste)

PART 2 question is can i format the body to use any other fonts or make the font bigger in the email? The above code uses a different font than the sendObject way. Any help would be appreciated. See below for strBody declaration.

****
' Set the Body of the Internal email
strBody = "Incident Number: " & Incident & vbCrLf & _
"Other Incident: " & OtherInc & vbCrLf & vbCrLf & _
"Priority: " & Priority & vbCrLf & vbCrLf & _
"Assigned Date: " & Date & vbCrLf & _
"Target Date: " & TargetDate & vbCrLf & vbCrLf & _
"Employee: " & strEmp & vbCrLf & _
"Ext: " & strExt & vbCrLf & vbCrLf & _
"Description: " & Description & vbCrLf & _
vbCrLf & vbCrLf
****
 
1) the last patches of outlook have a new protection system which asks to the user before sending mail.
You can try to use a solution already foun in following threads on this web site:
Thread605-570702
Thread707-529363
Thread605-384826
Thread68-468379

There is a third part object that allow you to bypass the problem (look for "redemption").

But I think that the better solution is the following (if you do not have a great number of mail to send):

a) use the method objmail.save instead of .send
b) after you will find saved mai in draft forlder
c) select all the mail and open it (select all and then press "OK")
d) send every opened mail by keeping pressed "ctrl" + "OK" buttons

It is a very fast way to solve the problem mantaining virus protection.

2) you can format the body if you use the property htmlbody instead of body (es. .htmlBody = strBody).
But remember that strBody must contain html sintax.
For example strbody=&quot;<strong> bye bye </strong>&quot; writes &quot;bye bye&quot; using bold.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top