I am trying to send an email dynamically to multiple recipients with the recipients defined within a variable. The code below works if I set selectedEmailList = "myemail@mindspring.com" (a single email address within quotes) but doesn't work if I set selectedEmailList = "emailname1@mindspring.com,emailname2@mindspring.com,emailname3@mindspring.com". I have tried semi-colons between email addresses to no avail, and also tried using <> at start and end of each email address--no luck there either.
Any suggestions on how to properly define 'selectedEmailList to send a message to multiple recipients at one time?
Here is the code:
Dim selectedEmailList
Dim sch, cdoConfig
sch = "
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "smtp.mydomain.org"
.update
End With
Dim cdoMessage
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "me@mindspring.com"
.To = selectedEmailList
.Subject = "Care Ministry Individual Care Contact Update"
.TextBody = "An online Care Ministry update is ready for viewing. Open the attachment to view/print the latest update regarding " & selectedFirstName & " " & selectedLastName
' NOTE: strEmail_attach_report is previously set and works as an attachment.
.AddAttachment (strEmail_attach_report)
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Any suggestions on how to properly define 'selectedEmailList to send a message to multiple recipients at one time?
Here is the code:
Dim selectedEmailList
Dim sch, cdoConfig
sch = "
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "smtp.mydomain.org"
.update
End With
Dim cdoMessage
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "me@mindspring.com"
.To = selectedEmailList
.Subject = "Care Ministry Individual Care Contact Update"
.TextBody = "An online Care Ministry update is ready for viewing. Open the attachment to view/print the latest update regarding " & selectedFirstName & " " & selectedLastName
' NOTE: strEmail_attach_report is previously set and works as an attachment.
.AddAttachment (strEmail_attach_report)
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing