D
David, the great
Hi,
Is there a way to validate an email address and to check whether it is
sendable?
Function EmailTo(ToEmail, FromEmail, strSubject, strBody)
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = strSubject
objMessage.From = FromEmail
objMessage.To = ToEmail
objMessage.HTMLBody = strBody
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MAILSERVER
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
If objMessage.Send Then
EmailTo = 1
Else
EmailTo = 0
End If
Set objMessage = nothing
End Function
The code shown as above, even if the mail is not successfully send, it still
return the value 1.
Is there a way to validate an email address and to check whether it is
sendable?
Function EmailTo(ToEmail, FromEmail, strSubject, strBody)
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = strSubject
objMessage.From = FromEmail
objMessage.To = ToEmail
objMessage.HTMLBody = strBody
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MAILSERVER
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
If objMessage.Send Then
EmailTo = 1
Else
EmailTo = 0
End If
Set objMessage = nothing
End Function
The code shown as above, even if the mail is not successfully send, it still
return the value 1.