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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDONTS mail troubleshooting

Status
Not open for further replies.

dbromberg

Programmer
Jun 24, 2002
29
0
0
US
I'm trying to send simple CDO mail from our NT 4.0 server. We have IIS 4.0 installed and the script below does not return any errors, so that would suggest CDO is installed. However, when the script is run, the "Mail is sent" thing pops up like it should, but upon checking email at the place where the email is specified to be sent, no email arrives. Any reason why this would be happening?


<%
Dim objMail
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

objMail.From = &quot;dbromberg@yahoo.com&quot;
objMail.Subject = &quot;How TO send email with CDONTS&quot;
objMail.To = &quot;dbromberg@yahoo.com&quot;
objMail.Body = &quot;This is an email message&quot; & vbcrlf&_
&quot;with CDONTS.&quot; & vbcrlf&_
&quot;It is really easy. &quot;
objMail.Send

Response.write(&quot;Mail was Sent&quot;)

'You must always do this with CDONTS.
set objMail = nothing
%>
 
I'm not sure. Wouldn't there be an error creating the file if the SMTP server was not set up? If it's not set up, how do I set it up? Is it something in IIS?

-dbromberg
 
Yes, we have an SMTP server set up.

-dbromberg
 
sometimes it just takes a while to get there, try setting the importance of your email message before calling the send method, set importance =1 (highest level i think)
 
It's running, and it never gets there, doesn't 'just take a while'.

-dbromberg
 
at work (from memory) we had similar problems where it would only send mails to internal addresses - in the end we used CDO.Configuration and CDO.Message objects, and gave the config object enough details to log into our mail server as the From address account. codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Okay, here's some more information. I did some looking around, and found that all the messages that I tried to send ended up in the folder c:\inetpub\Mailroot\Pickup folder. I assume that means that they were waiting for pickup, but they never got picked up. Know what to do about that?

Also, codestorm, could you elaborate on what you did at work to get yours working? I think in the end we will be using the 'to' address as an internal, does the 'from' address have to be internal as well?

-dbromberg
 
Heh, From my poking around it seems most (sensible) mail servers these days are now set so that only valid email accounts on the server can send mail, and only with the From address matching the address on the mail server you log in as. While you CAN set the mail server to just send any mail from anyone to anyone without any validation, it leaves you open to people using your mail server to send spam.

OK, here's the code from a simple test page a made a while ago (CDOHTMLMailUnicodeTest.vbs - sensitive data stripped) .. it works for me.

(I've also had a variant of this work from within a MSSQL SProc)

Dim obj_Configuration
Dim obj_Message
dim obj_Connection
dim obj_Recordset
dim str_SQL
dim str_Configuration
dim str_To
str_To = &quot;<ToEmailAddress>&quot;
str_Configuration = &quot;Set obj_Connection = CreateObject(&quot;ADODB.Connection&quot;)
obj_Connection.ConnectionString = &quot;DRIVER={SQL

Server};Server=<servername>;Database=<databasename>;UID=<username>;PWD=<password>&quot;
obj_Connection.Open
str_SQL = &quot;Select Q_InstText from quesInstTable where Q_OrgCode = 'Telstra' &quot;
str_SQL = str_SQL & &quot;and Q_ProfileCode = '360FQ'&quot;
Set obj_Recordset = obj_Connection.Execute(str_SQL)
Set obj_Configuration = CreateObject(&quot;CDO.Configuration&quot;)
With obj_Configuration.Fields
.Item(str_Configuration & &quot;sendusing&quot;) = 2
.Item(str_Configuration & &quot;SMTPServer&quot;) = &quot;203.89.65.131&quot; ' Set the SMTP server
.Item(str_Configuration & &quot;SMTPConnectionTimeout&quot;) = 30
.Item(str_Configuration & &quot;SendUserName&quot;) = &quot;<mail server account username(not email address)>&quot;
.Item(str_Configuration & &quot;SendPassword&quot;) = &quot;<password for above>&quot;
.Update
End With
Set obj_Message = CreateObject(&quot;CDO.Message&quot;)
With obj_Message
Set .Configuration = obj_Configuration
.MimeFormatted = True
.Fields.Update
.To = str_To
.From = &quot;<from email address - matches account logged into above>&quot;
.Subject = &quot;Unicode Mail Test - HTML&quot;
.HTMLBody = &quot;<html><head><meta http-equiv=&quot;&quot;Content-Type&quot;&quot; content=&quot;&quot;text/html; charset=&quot; & _
cdoShift_JIS & &quot;&quot;&quot;></HEAD><BODY>&quot; & obj_Recordset.Fields(0).Value & &quot;</BODY></HTML>&quot;
.AddAttachment &quot;c:\bendev\texture01.jpg&quot;
.Send
End With
Set obj_Recordset = Nothing
Set obj_Connection = Nothing
Set obj_Message = Nothing
Set obj_Configuration = Nothing codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
The pickup folder is where all your mail is placed when being sent. If it goes out (gets sent) it should either end up in the Queue folder or Bad mail folder ( that's saying your SMTP server is set up correctly.

I can just about guarantee you the SMTP service is not running.

In you IIS MMC, right click the default SMTP site folder. If it appears the service is running, click the stop selection, wait till it says (stopped) next to the folder, then right click it again and click on start.

Is the SMTP server your primary mail server?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top