When sending email I get a Delivery Status Notification (Failure) for any recipients outside my domain. My code is as follows:
Const cdoSendUsingMethod As String = "http://scemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSMTPServer As String = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort As String = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
EmailList = db.RetrieveRow(sql)
EmailSendTo = EmailList(0)
'EmailSendTo = "mylist@mylist.com"
EmailSubject = ReportName & " Report for " & Date.Now.ToShortDateString
EmailBody = EmailList(1) & " " & Date.Now.ToShortDateString & ". Please contact me if you have questions or concerns."
Try
objMessage = CreateObject("CDO.Message")
With objMessage.Configuration
.Fields(cdoSendUsingMethod) = cdoSendUsingPort
.Fields(cdoSMTPServer) = "smtp.comcast.net"
.Fields(cdoSMTPServerPort) = 25
.Fields.Update()
End With
With objMessage
.MimeFormatted = True
'.
.From = gFrom
.To = EmailSendTo
.Subject = EmailSubject
.TextBody = EmailBody
.AddAttachment(ReportPath)
.Send()
End With
Catch ex As Exception
End Try
objMessage = Nothing
Const cdoSendUsingMethod As String = "http://scemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSMTPServer As String = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort As String = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
EmailList = db.RetrieveRow(sql)
EmailSendTo = EmailList(0)
'EmailSendTo = "mylist@mylist.com"
EmailSubject = ReportName & " Report for " & Date.Now.ToShortDateString
EmailBody = EmailList(1) & " " & Date.Now.ToShortDateString & ". Please contact me if you have questions or concerns."
Try
objMessage = CreateObject("CDO.Message")
With objMessage.Configuration
.Fields(cdoSendUsingMethod) = cdoSendUsingPort
.Fields(cdoSMTPServer) = "smtp.comcast.net"
.Fields(cdoSMTPServerPort) = 25
.Fields.Update()
End With
With objMessage
.MimeFormatted = True
'.
.From = gFrom
.To = EmailSendTo
.Subject = EmailSubject
.TextBody = EmailBody
.AddAttachment(ReportPath)
.Send()
End With
Catch ex As Exception
End Try
objMessage = Nothing