Jump to content

ASP CDO Mail


Recommended Posts

I hate asp.

<!-- #include file="common.asp" -->
<%
contact = rq("contact")
bname = rq("bname")
email = rq("email")
comments = rq("comments")

' Set the mail server configuration

Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From=email
myMail.To="###########"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="relay-hosting.secureserver.net"
'myMail.Configuration.Fields.Item _
'("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.TextBody=comments
myMail.Send

response.redirect "contact.asp?msg=sent"
%>

Why isn't this sending. This is straight off the examples presented at www.w3schools.com and various

other tutorials..Plus code presented on Godaddy's own knowledge base.

 

This should very simply send an email. Instead it's returning:

error '80040211'

/docontact.asp, line 22

Any advice?

 

Line 22, by the way, is the "myMail.Send" line.

 

Link to comment
Share on other sites

I think you should be getting a syntax error even before then. As far as I remember you cannot use the line continuation _ to split a method and its arguments like that. eg;

 

Change...

 

myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

 

to

 

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

 

You should also try changing that value above from 2 to 1 depending on where your mail server is hosted. (locally or remote)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.