Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

SendUsing invalid configuration error code 80040220 solution

$
0
0
This is probably is old news but I think it is worth posting. Last night I wanted to send email with attachment using script but I ran into problem. When I send the email I get SendUsing Invalid Configuration error, Literally spent lots of time trying to figure out a solution. So I google and found most of the threads were old. I did not find any solution. Maybe I did not search hard enough. However, I found an old thread with script that might work. I changed some wordings but the script is similar to the original.

Dim objMessage
Set objMessage = CreateObject("CDO.Message")
With objMessage
.Subject = "type Subject information here"
.From = "type your email address here"
.To = "type email address of the recipient here"
.TextBody = "type text content here"
.AddAttachment "Type attachment path here"
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Localhost"
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Configuration.Fields.Update
.Send
End With

I spent a lot of time trying to find out why I kept getting SendUsing error. I made changes here and there but the error keeps popping up. I finally found why it won't work. "Localhost" is not a valid input. It has to be literally the smtp server name of the default email account.

I went to my outlook account settings. Double clicked the default email address. Copied the smtp server name. Pasted it in place of "Localhost" and the script worked.

Before:

.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Localhost"


After:

.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "the name of the smtp sever name of the default email account".

Hope this helps.

Luis.

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>