Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending an email using CDO

Status
Not open for further replies.

mikelawrence

Programmer
Sep 19, 2001
68
GB
I'm moving from one windows 2003 server to another, on my old one i can send emails using a script but the exact same script fails on my new server. When i look in the bad mail folder the error message is

Diagnostic-Code: smtp;503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.

My code is
<%@ language="javascript" %>
<%
var myMail = Server.CreateObject("CDO.Message");
myMail.Subject="Sending email with CDO"
myMail.From="mike@rewardlife.com"
myMail.To="mike@rewardlife.com"
myMail.TextBody="This is a message."
myMail.Send()
%>

Or my VB version is
<%@ language="vbscript" %>

<%
Dim iMsg
set iMsg = CreateObject("CDO.Message")
With iMsg
.To = "mike@rewardlife.com"
.From = "mike@rewardlife.com"
.Subject = "Email sent from VB script"
.TextBody = "This is the body of the email."
.Send
End With
Set iMsg = Nothing
%>

I've checked the write permissions on the inetpub/mailroot folder and that seems ok? My hosting company seem to be ignoring me and this is preventing the migration from taking place so i would really appreciate any ideas. This is not my area so i could well be missing something blindingly simple so don't make any assumptions about my competence!

Thanks

mike


 
Has the SMTP service been installed on the new server? Was it installed on the old server?

 
Yep, i think so, on IIS there is a default SMTP virtual server running and all the properties seem the same as on my old server.

thanks for the interest, any other ideas?

mike
 
Have a look at this:


the script towards the bottom deals with authentication and may be the missing link for you.

Twist

===========================================
Everything will be OK in the end.
If it's not OK, then it's not the end
 
ok i'll look at this but it looks like you should only need authentication for a remote smtp server whereas mine should be local. I'll give it a go though,

thanks

mike
 
You may need to look at other ASP code. Performing a CDO Send requires quite a few more objects, constants, etc... than you are showing. (i.e. There is no connection method or server name) You may have an include file that configures the connection method.

I regularly use CDO in VBScript and it just appears that you have a lot missing.

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
PScottC,
Doing a CDO send does not require more objects if the send is happening from an SMTP server, as the below reflects, straight from Microsoft's scriptcenter:

Code:
Set objEmail = CreateObject("CDO.Message")

objEmail.From = "monitor1@fabrikam.com"
objEmail.To = "admin1@fabrikam.com"
objEmail.Subject = "Atl-dc-01 down" 
objEmail.Textbody = "Atl-dc-01 is no longer accessible over the network."
objEmail.Send

As far as a solution, have a look at this:

 
Thanks for the correction TFG... I don't typically use CDO on a box with IIS.

A follow up for my reference... Does that mean that CDO defaults to using IIS's pickup folder? How does it get the message into the system?

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
I've never really thought about it. I see your point though. I myself haven't ever used a script without using a remote SMTP server. I think I may have found an answer, if you read into the "solution number 1 or 2" of the below:


Basically, I think within the script, it looks at the cdosys.dll, and that determines whether it's loaded locally, or remotely. I'm just guessing on this one though.
 
I found it here: [URL unfurl="true"]http://msdn.microsoft.com/en-us/library/aa565355(EXCHG.80).aspx[/url]

If the SMTP service is installed on the local computer, then the value defaults to cdoSendUsingPickup (1).

At that point it can read the location of the Pickup folder from the registry.

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top