debbiedoobie10
Registered User.
- Local time
- Yesterday, 22:29
- Joined
- Oct 1, 2010
- Messages
- 13
I'm new to VBA code and do not have any experience with HTML. I have a project to send Christmas emails from access without using outlook. The problem I'm having is the body of the email which contains text, picture and background. Here is some of the code. The body of the email was a word document converted to web page filtered. But when I do a test email it has a red X for the picture and not all the text displays. Has anyone been able to do this successfully? Any suggestions?
Dim cdoConfig As Object
Dim cdoMessage As Object
Dim Configuration As Object
Set cdoConfig = CreateObject("CDO.Configuration")
Set cdoMessage = CreateObject("CDO.Message")
Open "C:\AccessScript\Christmas2019.HTM" For Input As 1
Do While Not EOF(1)
'Input #1, strLine
Line Input #1, strLine
Strhtml = Strhtml & strLine
Loop
'build and send email message
Set MyDb = CurrentDb
Set rs = MyDb.OpenRecordset("tblChristmasx", dbOpenDynaset)
Do Until rs.EOF
With cdoMessage
Set .Configuration = cdoConfig
.Subject = "AMCI Christmas"
.From = "debbie@gmail.com"
.To = rs!EmailAddress
.HTMLBody = Strhtml
.Send
End With
rs.MoveNext
Loop
Set cdoConfig = Nothing
Set cdoMessage = Nothing
Set Configuration = Nothing
Close 1
Dim cdoConfig As Object
Dim cdoMessage As Object
Dim Configuration As Object
Set cdoConfig = CreateObject("CDO.Configuration")
Set cdoMessage = CreateObject("CDO.Message")
Open "C:\AccessScript\Christmas2019.HTM" For Input As 1
Do While Not EOF(1)
'Input #1, strLine
Line Input #1, strLine
Strhtml = Strhtml & strLine
Loop
'build and send email message
Set MyDb = CurrentDb
Set rs = MyDb.OpenRecordset("tblChristmasx", dbOpenDynaset)
Do Until rs.EOF
With cdoMessage
Set .Configuration = cdoConfig
.Subject = "AMCI Christmas"
.From = "debbie@gmail.com"
.To = rs!EmailAddress
.HTMLBody = Strhtml
.Send
End With
rs.MoveNext
Loop
Set cdoConfig = Nothing
Set cdoMessage = Nothing
Set Configuration = Nothing
Close 1