I don't recommend using an attachment field as a way to store and manage docs. I recommend storing the file path in a text field.
This is the simplest HTML example I could find. Here is some code that I use to automate a request to clients. It references three controls on the current form, so you may want to hardcode something else or....
The HTML displays a message, a hyperlink, and a logo. The logo is downloaded from a web server and displays an alt message if the link is broken.
Also, there is a return receipt request that I commented out.
Code:
Dim strPath As String
Dim strFile As String
Dim strBillType As String
Dim strStart As String
Dim strEnd As String
Dim strReturn As String
Dim strTo As String
Dim strSubject As String
Dim strBody As String
Dim iCfg As Object
Dim iMsg As Object
strPath = "\\ServerName\Folder\"
strFile = "FileName.Extension"
strBillType = Me.cmbServiceType.Column(1)
strStart = Format(Me.BillPeriodStart.Value, "mmm dd, yyyy")
strEnd = Format(Me.BillPeriodEnd.Value, "mmm dd, yyyy")
strReturn = "J.Blow@MyDomain.com"
strTo = "Name@TheirDomain.com"
strSubject = "Request for Money Please"
strBody = "<body>" & vbCrLf & _
"<p> </p>" & vbCrLf & _
"<p>Please find the attached request for remittance.</p>" & vbCrLf & _
"<p>The " & strBillType & " statement for the billing period " & strStart & " to " & strEnd & " is now due.</p>" & vbCrLf & _
"<p> </p>" & vbCrLf & _
"<p> </p>" & vbCrLf & _
"<p><br>" & vbCrLf & _
"<br>" & vbCrLf & _
"</p>" & vbCrLf & _
"" & vbCrLf & _
"<p>" & vbCrLf & _
"<p><a href=""http://www.MyDomain.com/"">Visit Our Website</a> " & vbCrLf & _
"<p>" & vbCrLf & _
"<img border=""0"" id=""_logoSmall"" src=""http://MyDomain.com/logo/Logo_Email.png"" width=""131"" height=""80"" alt=""Serving the industry since 1909""></p>" & vbCrLf & _
"<p>Joe Blow<br>" & vbCrLf & _
"Accounts Payable</p>" & vbCrLf & _
"" & vbCrLf & _
"</body>"
Set iCfg = CreateObject("CDO.Configuration")
Set iMsg = CreateObject("CDO.Message")
With iCfg.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.MyDomain.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "automated@MyDomain.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password"
.Item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress") = "Joe Blow <J.Blow@MyDomain.com>"
.Update
End With
' Const cdoDispositionNotificationTo = "urn:schemas:mailheader:disposition-notification-to"
' Const cdoReturnReceiptTo = "urn:schemas:mailheader:return-receipt-to"
With iMsg
.Configuration = iCfg
' .Fields(cdoDispositionNotificationTo) = strReturn
' .Fields(cdoReturnReceiptTo) = strReturn
' .Fields.Update
.Subject = strSubject
.To = strTo
.Bcc = strReturn
.HTMLBody = strBody
.AddAttachment strPath & strFile
.Send
End With
Set iMsg = Nothing
Set iCfg = Nothing
MsgBox "The Email Was Sent"