问题
I have hosted my site, while sending mail gives me error as below:
CDO.Message.1 error '80040220' The "SendUsing" configuration value is invalid. /contact.asp, line 131
I have following code:
<%
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "<my-smtp-port>"
.Item(sch & "smtpserverport") = 25
.update
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "fromemail"
.To = "toemail"
.Subject = "abc"
.TextBody = "hello"
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>
Please help me how to resolve this query?...
回答1:
I got the solution. I refer this link http://forums.iis.net and got exact code and replace with the code given in Sending a text e-mail using a remote server:. Below is code is used:
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>
来源:https://stackoverflow.com/questions/33391500/cdo-message-1-error-80040220