I tried the following, but unfortunately does not send. The xxx, were replaced for valid email addresses.
It tells me "The transport failed to connect to the server"
What should I put in
config.Fields(cdoSMTPServer).value
Should I put the Outgoing Server of my ISP? I believe I placed the correct server name.
Code:
Dim mail As CDO.message
Dim config As CDO.Configuration
Set mail = CreateObject("CDO.Message")
Set config = CreateObject("CDO.Configuration")
config.Fields(cdoSendUsingMethod).value = cdoSendUsingPort
config.Fields(cdoSMTPServer).value = "xxx"
config.Fields(cdoSMTPServerPort).value = 587 '25
config.Fields.update
Set mail.Configuration = config
With mail
.To = "xxx@xxx.org"
.From = "xxx@xxx.com"
.Subject = "First email with CDO"
.TextBody = "This is the body of the first plain text email with CDO."
'.AddAttachment "C:\path\to\a\file.dat"
.send
End With
Set config = Nothing
Set mail = Nothing
Used to test sending HTML or plain text emails directly from Access without using Outlook. Attachments can also be added. Attachments can also be added. EMail settings can optionally be included in the email body.
Used to test sending HTML or plain text emails directly from Access without using Outlook. Attachments can also be added. Attachments can also be added. EMail settings can optionally be included in the email body.