0

This following code says "SendUsing" configuration value is invalid. Note: Set myMail=CreateObject(CDO.Message") says Let and Set are not supported

<%
Dim myMail=CreateObject("CDO.Message")
myMail.Subject="CDO Mail"
myMail.From="utilise.use@gmail.com"
myMail.To="utilise.use@gmail.com"
myMail.TextBody="Dear God"
myMail.Send
myMail=nothing

%>
  • Take a look at this Question : [asp.net send mail in vb.net](http://stackoverflow.com/questions/8755758/asp-net-send-mail-in-vb-net) – medo medo Feb 26 '17 at 13:31

1 Answers1

0

This is what I use. The configuration may not be needed on your end but in most cases you have to specify your server and from-address so the message isn't seen as spam. 127.0.0.1 is the mail server, it may differ for you.

set objMessage = createobject("cdo.message") 
set objConfig = createobject("cdo.configuration") 
Set Flds = objConfig.Fields 

Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="127.0.0.1" 
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 

Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="me@mydomain.com" 
Flds.update 
Set objMessage.Configuration = objConfig 
objMessage.To = "someone@somewhere"
objMessage.From = "me@mydomain.com" 
objMessage.Subject = "Hello"
objMessage.fields.update 

content = "Dear God"
objMessage.HTMLBody = content
objMessage.Send