Vijaya Savant
Vijaya Savant

Reputation: 135

CDO.Message.1 error '80040220'

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?...

Upvotes: 1

Views: 7494

Answers (1)

Vijaya Savant
Vijaya Savant

Reputation: 135

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="[email protected]"
myMail.To="[email protected]"
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
%>

Upvotes: 1

Related Questions