SendEmail with Embedded Graphics

B

Bryan

I am using the Send E-mail routine to send e-mail from Access 2003.

Is it possible to add embedded graphics to this? I know I would attach the
jpg file, but how would I reference the graphics in the HTML?


Public Sub SendEmail(strFrom As String, strTo As String, strCC As String,
strSubject As String, strBody As String, Optional strAttachments As String)
' strAttachments must be separated by Pipes (|) and have a trailing pipe
'On Error GoTo SendEmail_Err

Dim iMsg As Object
Dim iConf As Object
Dim Flds As Object
Dim strHTML As String
Dim strServer As String

Const cdoSendUsingPort = 2 ' Send by connecting to port 25(2?) of the
SMTP server.

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort ' Set the CDOSYS configuration fields to use port 25 on
the SMTP server.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
DLookup("[Values]", "Variables", "[Name]='MailServer'")

..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10

'.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
.Update
End With

With iMsg ' Apply the settings to the message.
.Configuration = iConf
.To = strTo
.CC = strCC
'.bcc = ""
.From = strFrom
.Subject = strSubject
.HTMLBody = strBody

AddAttachments:
If Len(strAttachments) > 1 Then 'Add Attachemnts from comma Pipe
| (comma doesn't work) separated list strAttachments
.addattachment Left(strAttachments, InStr(strAttachments, "|") -
1)
strAttachments = Mid(strAttachments, InStr(strAttachments, "|")
+ 1)
GoTo AddAttachments
End If
.Send
End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
Exit Sub

SendEmail_Err:
MsgBox ("There was a problem sending the e-mail: " & Err.Description &
":" & Err.Number)

End Sub


Thanks for any help.

Bryan..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top