Emailing From Access

S

Simon

I have a few buttons on my form that run some VB code that create an
email in outlook. all the emails are created in plain text and not
html.
Is there a way to change this automatical.

also i have to select which account to send the email from can this be
selected automaticall

Thanks

Simon
 
R

Ron2006

Here is how to create an email with HTML formatted body:

Set o = CreateObject("Outlook.Application")
Set m = o.CreateItem(0)


m.To = Forms![HiddenKey]![HManagerEmail]
' m.cc = for copies

' m.bcc = for blind copies

m.Subject = "Defect Analysis for " & Forms![fieldname]

' m.body = "now is the time" if html not
desired

==================================
m.bodyformat = 2 ' This makes the body HTML
m.htmlbody = Chr(13) & Chr(13) & _
"<body><Table><tr><td><b> Date: </b></td><td>" & Date &
"</td></tr>" & _
"<tr><td><b>Manager: </b></td><td>" &
Forms![HiddenKey]![HManager] & "</td></tr>" & _
"<tr><td><b>Name: </b></td><td>" &
Forms![HiddenKey]![HCompany] & "</td></tr>" & _

"<tr><td></td><td></td></tr>" & _
"</Table></body>"
===================================

' m.send ' to send it instead of displaying it.
m.Display

-----------------------------------------------------------
I am not sure what you mean by "select which account to send the email
from "

The "FROM" in the email will always be the sender.

Ron
 
Top