Hoping for a little help here. I am working on a script that will send automated emails. I have run into a little snag. After moving email addresses in Access into an array (emailArray), I am using the following code to send the email:
Here's where I'm stuck...I need the actual content of the email (currently objMessage.TextBody = "Testing") to be the contents of a Word document.
I have been unable to find any resources/tutorials online that might help. If anyone could point me the right direction it would be greatly appreciated. Thanks in advance for any help.
Code:
For i = 0 to UBound(emailArray)
'Sending a text email using a remote server
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.Sender = "me@myemail.com"
objMessage.To = emailArray(i)
objMessage.TextBody = "Testing"
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "smtp.myserver.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
Next
Here's where I'm stuck...I need the actual content of the email (currently objMessage.TextBody = "Testing") to be the contents of a Word document.
I have been unable to find any resources/tutorials online that might help. If anyone could point me the right direction it would be greatly appreciated. Thanks in advance for any help.