hello,
I found the following code on the Internet - to sent an email from Access without using OUTLOOK.
Code:
Dim s As String
Dim iCfg As Object
Dim iMsg As Object
Dim ito As String
ito = Me.E_mail_Address
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") = "SERVER"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "USER"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "PASS"
.Item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress") = "EMAIL"
.Update
End With
With iMsg
.Configuration = iCfg
.Subject = "Subject"
.To = ito
.TextBody = " TEST TEST TEST"
.AddAttachment "FullPathToAttachment"
.Send
End With
Set iMsg = Nothing
Set iCfg = Nothing
It works great. But! I need to send a formatted email. In other words, I need to put in .TextBody my HTML code. But my code is long and complicated, what can I do?
Thank you very much!