Link to home
Start Free TrialLog in
Avatar of -Dman100-
-Dman100-Flag for United States of America

asked on

CDO help

I'm using Collaborative Data Objects to send auto-generated emails.  I have used this many times before with no problem.

I'm testing this on my development server and recently made some changes by setting up DNS.  When I run the CDO script, I don't get any errors, but the email isn't coming through to me.

I don't think it is anything in my code, but I'm not certain.  I've looked in the bad mail folder under INETPUB and don't see any failed messages.  My router is setup to port forward for port 25 SMTP...it's the same configuration I've always had.  So, I can only assume that my recent DNS setup somehow messed up my SMTP mail server.  Again, this is only a testing/development box and I use the SMTP to just test the mail scripts to make sure they are processing.

In case there is any error in my code, please see below:

mailbody = "<font size=3 face = Verdana>" & "<strong>" & "*** This message has been automatically generated -- DO NOT REPLY. ***" & "</strong>" & "</font>" & vbCRLF & vbCRLF
mailbody = mailbody & "<font size=2 face=Verdana>" & "The following technical support request was received via the CompassLearning web site. The inquirer's contact information is provided below." & "</font>" & vbCRLF & vbCRLF
mailbody = mailbody & "First Name:  " & fname & vbCRLF & vbCRLF
mailbody = mailbody & "Last Name:  " & lname & vbCRLF & vbCRLF
mailbody = mailbody & "School Name:  " & schoolname & vbCRLF & vbCRLF
mailbody = mailbody & "Address:  " & address & vbCRLF & vbCRLF
mailbody = mailbody & "City:  " & city & vbCRLF & vbCRLF
mailbody = mailbody & "State:  " & state & vbCRLF & vbCRLF
mailbody = mailbody & "Zip:  " & zip & vbCRLF & vbCRLF
mailbody = mailbody & "Phone:  " & phone & vbCRLF & vbCRLF
mailbody = mailbody & "Email:  " & email & vbCRLF & vbCRLF
mailbody = mailbody & "Product Type:  " & producttype & vbCRLF & vbCRLF
mailbody = mailbody & "Comment:  " & comment & vbCRLF & vbCRLF
                                    
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
                        
' Outgoing SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.1.20"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update
                        
' Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "dwayneepps@centurytel.net"
objCDOSYSMail.To = "dwayneepps@centurytel.net"
objCDOSYSMail.Subject = "Technical Support Request"
objCDOSYSMail.HTMLBody = mailbody
objCDOSYSMail.Send
                        
'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing

Any suggestions on what to check to see why the mail isn't coming through??  I know enough about mail servers to be dangerous and that's about it.  I'm not sure how to troubleshoot this especially since I'm not getting any errors.  The page looks like it is processing fine....just no email.

Thanks,
-D-
Avatar of Irwin Santos
Irwin Santos
Flag of United States of America image

What server os? running Exchange?

also

as the 1st & 2nd lines of code, make sure you have
<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

AND

In IE , TOOLS-INTERNET OPTIONS - ADVANCED tab, locate and uncheck  SHOW FRIENDLY HTTP ERROR MESSAGES

Run the code again.. any errors reported?
Avatar of peterxlane
peterxlane

Do you have On Error Resume Next somewhere in your code that is preventing you from seeing an error?

Could the fact that the to and from address is the same an issue?

Does the badmail folder still get populated on the web server when you are using a remote mail server like this?  I know it does when you don't use the CDO.Configuration part of the code, but I have always wondered where it went when you were actually sending the mail through another server.



Avatar of -Dman100-

ASKER

Hey Irwin,

It's Dwayne...I'm back again :)

The server OS is Windows 2000 Server.  I'm not running exchange.  I just have IIS smtp mail setup so I can test my mail scripts.

I'm wondering if when you helped me setup DNS, if it effected the SMTP mail.  My first thought was if the server-name changed from:
dwayne-server
to
dwayne-server.com

Would that cause the problem for the mail not to be delievered?

I'm really in the dark when it comes to smtp and mail server setup?  I really do not know what to look for?

Thanks again for your help.
-D-
Hey Dwayne,

When I read the questions I fire away without looking at who wrote it.. but not to say that you're not another face in the crowd.. In fact, you hold the record of all the several thousand questions that I've answered, to have the most lengthiest solution.. being #1 is not too bad huh?

Anyway, I'm off to the office for work. post back a shout out so that my office computer will get the link to this question..

thanks,

Irwin
if you can sign onto your test server console, run through this test to see if your server has communication to your relay.  use the address in your script as the target.

http://amset.info/exchange/telnet-test.asp
Hey Irwin,

yeah, working thru the DNS solution was pretty lengthy...I'll take being #1 on that :)  Glad you stuck it out with me.

I figure I'm missing something really simple on this one because I've had it working with no problems in the past.

I'm heading to the gym...I'll check back in about an hour.

WMIF, I tried the link, but it came up "Page Not Found"??
maybe you have bigger dns issues than you though. :P

try with the www:
http://www.amset.info/exchange/telnet-test.asp
"objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.1.20"

user your external WAN IP to test outgoing...  but send only 1 (one) record, not your entire database
Hi  Irwin,

Just got back and read your post.  I am a little confused.  Could you explain what you mean my external WAN IP?  I thought I would use my server IP to relay the email?

How do I send 1 record?
192.168.1.20 is your internal server IP.. for testing purposes, what is your EXTERNAL to the Internet IP

"How do I send 1 record?"

check that, I reviewed your code and you're not using a database
SOLUTION
Avatar of darkeryu
darkeryu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have a dynamic IP that is generated from my ISP, is that the external IP you need?

I checked the event log and it showed several warnings when I had tried to run the cdo script.  This is the error message:

Message delivery to the remote domain 'centurytel.net' failed.  The error message is 'An smtp protocol error occurred.  The smtp verb which caused the error is 'MAIL'.  The response from the remote server is '533 5.3.0 207.119.5.179 rejected.

Does that help?
"I have a dynamic IP that is generated from my ISP, is that the external IP you need?"

yes.. apply that... what happens?
It doesn't allow me to change the IP...

I can either choose "All Unassigned" or use 192.168.1.20
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay...

I received the following error:

"The transport failed to connect to the server"
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>I checked the event log and it showed several warnings when I had tried to run the cdo script.  This is the error message:

Message delivery to the remote domain 'centurytel.net' failed.  The error message is 'An smtp protocol error occurred.  The smtp verb which caused the error is 'MAIL'.  The response from the remote server is '533 5.3.0 207.119.5.179 rejected.<<

i just saw this from before.  which server is this error from?  web server or email server?
The error message was what was showing up in the event log on my development server.  I have a server that I use for development and testing.

The warning in the event log shows the source as: SMTPSVC

Is this what you are aking?

so this is the development web server?  if so, do you have the same log when you use an internal ip address?  the connection is probably refused because of the firewall, but it shouldnt be a problem with the internal ip.

were you able to open the page that i gave you above to do the test?  if not, let me know and ill copy/paste it here for you.
I wasn't able to openthe page that you sent as a URL.

I'm not sure what you meant by "do you have the same log when you use an internal ip address"?

Could you explain?

Thanks for your help.  I appreciate it.

-D-
as i understand it, you are receiving this error message on your development web server.  irwinpks had asked you to change the ip address that you script was pointing to, and you posted this error message.  i was wondering if you had received this error message before making this change or only after.  also i was curious if you would change the ip back to the internal address if it would give you the same error.




here is a paste from that site, hopefully it makes sense:

A Telnet test is used for doing diagnosis of your SMTP server. It can confirm whether the Exchange server is processing email correctly and is really the manual way of entering the commands that SMTP servers do when communicating.

It involves establishing a Telnet session from a computer that is not located on the local network to the external (public) IP address of the Exchange server. You need to carry out the test from a machine at home, or from another office. Doing the test from a machine on your own network will produce useless results.

 
Note: This is NOT a test for open relay. For open relay testing, please see our spam cleanup page.

Start a command prompt.
Either click start, run and type CMD
or Choose Command Prompt from Start, Programs, Accessories, Command Prompt
 
Type "telnet" (minus quotes) and press enter.
 
At the Telnet prompt, type

set localecho

(minus quotes) and press enter. This lets you see what is going on.
 
Still in the telnet prompt, enter the following command and then press enter

open external-ip 25

where external-ip is your external IP address eg:

open 111.222.333.444 25
 
You should get a response back similar to the following:

220 mail.server.domain Microsoft ESMTP MAIL Service, Version: 6.0.2790.0 Ready at
 
Type the following command in to the telnet windows:

ehlo testdomain.com

and press enter (note "testdomain.com" can be anything that isn't a domain that the Exchange server is responsible for.
 
After pressing OK you should get a response back

250 OK
 
Type the following command in to the telnet window:

mail from:address@testdomain.com

and press enter (again where address@yourdomain is an email address that is not on the Exchange server. Note the lack of space between from and the first part of the address).
 
After pressing OK you should get a response back:

250 2.1.0 address@testdomain.com....Sender OK

If you get "Access Denied" or another error message at this point then the remote server has an issue with your server connecting to them.


Type the following command in to the telnet window:

rcpt to:address@yourdomain.com

and then press enter (where address@yourdomain.com is an address that is on your Exchange server Once again note the lack of space between to and the first part of the e-mail address).

If you get accessed denied or another message at this point then the mailbox has a problem - full, non-existent etc.
 
After pressing ok you should get the response back:

250 OK - address@yourdomain.com
 
Now type

DATA

and press enter.
 
You should get a response back similar to:

354 Send data. End with CRLF.CRLF
 
Now you can type your message.
Enter the following in to the Window:

Subject: test message

Press enter TWICE.
 
Next type in some body message, something like:

This is a test message sent via telnet

And press enter.
 
Enter a full stop (or period) and press enter.

You should get back the response:

250 OK
 
Finally close the session by typing

Quit

and press enter.
 
You should get which will return the response:

221 closing connection
 
You should now have an email with the subject and the body as entered.
"i was wondering if you had received this error message before making this change or only after."

I received the error message before changing the IP, so I was using the internal IP of my server.

I tried the telnet session per the article, but the following paragraph says the telnet session for my home network is useless:  "It involves establishing a Telnet session from a computer that is not located on the local network to the external (public) IP address of the Exchange server. You need to carry out the test from a machine at home, or from another office. Doing the test from a machine on your own network will produce useless results."

I went ahead and did the telnet session as described and got the following message at the very end:

250 2.6.0 <DWAYNE-SERVERTchoNo000000001@dwayne-server>Queued mail for delivery

Nothing is in the queued folder?

-D-

SOLUTION
Avatar of nurbek
nurbek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>I went ahead and did the telnet session as described and got the following message at the very end:

250 2.6.0 <DWAYNE-SERVERTchoNo000000001@dwayne-server>Queued mail for delivery

Nothing is in the queued folder?<<

great.  im glad you continued anyways after reading that paragraph.  the page that i got this from is a site that is troubleshooting for exchange server.  in this application the test isnt useless.  250 codes mean "good".  this means that your web server is communicating with your exchange server.  the mail should be queued on your exchange if its not getting any further now.  do you see anything in there?
Okay, I checked the following folders under INETPUB >> MAILROOT

BadMail, Drop, Mailbox, Pickup, Queue, Route, SortTemp.

The only folder that contained any files was in the BadMail folder.  This folder contained several files that where logs of emails that I had sent using my mail script using CDO and it also included the message I had sent thru telnet.

Here is the text from the message sent via telnet:

From: postmaster@dwayne-server
To: dwayneepps@centurytel.net
Date: Thu, 4 May 2006 19:13:23 -0500
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
      boundary="9B095B5ADSN=_01C66FC4F548163000000001dwayne?server"
Message-ID: <8wSA1XvpF00000001@dwayne-server>
Subject: Delivery Status Notification (Failure)

This is a MIME-formatted message.  
Portions of this message may be unreadable without a MIME-capable mail program.

--9B095B5ADSN=_01C66FC4F548163000000001dwayne?server
Content-Type: text/plain; charset=unicode-1-1-utf-7

This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

       dwayneepps@centurytel.net




--9B095B5ADSN=_01C66FC4F548163000000001dwayne?server
Content-Type: message/delivery-status

Reporting-MTA: dns;dwayne-server
Received-From-MTA: dns;yahoo.com
Arrival-Date: Thu, 4 May 2006 19:12:26 -0500

Final-Recipient: rfc822;dwayneepps@centurytel.net
Action: failed
Status: 5.3.0
Diagnostic-Code: smtp;553 5.3.0 207.119.25.33 rejected; see http://www.njabl.org/cgi-bin/lookup.cgi?query=207.119.25.33


--9B095B5ADSN=_01C66FC4F548163000000001dwayne?server
Content-Type: message/rfc822

Received: from yahoo.com ([192.168.1.100]) by dwayne-server with Microsoft SMTPSVC(5.0.2195.6713);
       Thu, 4 May 2006 19:12:26 -0500
subject: test messatgge
From: dwayneepps@centurytel.net
Bcc:
Return-Path: dwayneepps@centurytel.net
Message-ID: <DWAYNE-SERVERTchoNo00000001@dwayne-server>
X-OriginalArrivalTime: 05 May 2006 00:12:57.0033 (UTC) FILETIME=[A9481390:01C66FD8]
Date: 4 May 2006 19:12:57 -0500

this is a test message sent via telnet


--9B095B5ADSN=_01C66FC4F548163000000001dwayne?server--


Here is the text from another message that I had sent using my mail script via CDO that failed:

From: postmaster@dwayne-server
To: dwayneepps@centurytel.net
Date: Thu, 4 May 2006 10:16:06 -0500
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
      boundary="9B095B5ADSN=_01C66927D0CF406000000008dwayne?server"
Message-ID: <x4A2DreBB00000005@dwayne-server>
Subject: Delivery Status Notification (Failure)

This is a MIME-formatted message.  
Portions of this message may be unreadable without a MIME-capable mail program.

--9B095B5ADSN=_01C66927D0CF406000000008dwayne?server
Content-Type: text/plain; charset=unicode-1-1-utf-7

This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

       dwayneepps@centurytel.net




--9B095B5ADSN=_01C66927D0CF406000000008dwayne?server
Content-Type: message/delivery-status

Reporting-MTA: dns;dwayne-server
Received-From-MTA: dns;dwayneserver
Arrival-Date: Thu, 4 May 2006 10:16:06 -0500

Final-Recipient: rfc822;dwayneepps@centurytel.net
Action: failed
Status: 5.3.0
Diagnostic-Code: smtp;553 5.3.0 207.119.5.179 rejected; see http://www.njabl.org/cgi-bin/lookup.cgi?query=207.119.5.179


--9B095B5ADSN=_01C66927D0CF406000000008dwayne?server
Content-Type: message/rfc822

Received: from dwayneserver ([192.168.1.20]) by dwayne-server with Microsoft SMTPSVC(5.0.2195.6713);
       Thu, 4 May 2006 10:16:06 -0500
From: <dwayneepps@centurytel.net>
To: <dwayneepps@centurytel.net>
Subject: CompassLearning Technical Support Request
Date: Thu, 4 May 2006 10:16:06 -0500
Message-ID: <002401c66f8d$aa58b550$1401a8c0@dwayneserver>
MIME-Version: 1.0
Content-Type: multipart/alternative;
      boundary="----=_NextPart_000_0025_01C66F63.C182AD50"
X-Mailer: Microsoft CDO for Windows 2000
Thread-Index: AcZvjapXuTltQD41Sw6EdJFh4boyFA==
Content-Class: urn:content-classes:message
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Return-Path: dwayneepps@centurytel.net
X-OriginalArrivalTime: 04 May 2006 15:16:06.0635 (UTC) FILETIME=[AA6363B0:01C66F8D]

This is a multi-part message in MIME format.

------=_NextPart_000_0025_01C66F63.C182AD50
Content-Type: text/plain;
      charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

*** This message has been automatically generated -- DO NOT REPLY. ***
The following technical support request was received via the
CompassLearning web site. The inquirer's contact information is provided
below. First Name: Elizabeth Last Name: Pennington School Name: Virginia
Beach High School Address: 10098 Virginia Beach Ave. City: Virginia
Beach State: 46 Zip: 77079 Phone: 5403692584 Email: eliwin67@aol.com
Product Type: 2 Comment: this is a test

------=_NextPart_000_0025_01C66F63.C182AD50
Content-Type: text/html;
      charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<font size=3D3 face =3D Verdana><strong>*** This message has been =
automatically generated -- DO NOT REPLY. ***</strong></font>

<font size=3D2 face=3DVerdana>The following technical support request =
was received via the CompassLearning web site. The inquirer's contact =
information is provided below.</font>

First Name:  Elizabeth

Last Name:  Pennington

School Name:  Virginia Beach High School

Address:  10098 Virginia Beach Ave.

City:  Virginia Beach

State:  46

Zip:  77079

Phone:  5403692584

Email:  eliwin67@aol.com

Product Type:  2

Comment:  this is a test


------=_NextPart_000_0025_01C66F63.C182AD50--



--9B095B5ADSN=_01C66927D0CF406000000008dwayne?server--



Is there a configuration problem with my smtp mail server?  Is this why the messages are failing?

Thanks for your help.
Regards,
-D-
try this same telnet test, but do it from your mail server to the centurytel.net mail server (209.142.136.228).  
Just to make sure I understand correctly, when I go thru the telnet session, I should use:

mail from:(use my server ip here)

and

rcpt to:209.142.136.228

Is that correct?
actually, those lines should be actual email addresses, not ip addresses.
Okay, I apologize, I'm a little confused.  When you say to do a telnet test and do it from my mail server to the centurytel mailserver (209.142.136.228), could you explain further.  I'm not sure what you mean by that.  My apologies.  I'm smtp impaired :)

when you are sending an email to that address@centurytel.net, your mail server does the same thing as you are doing here to contact the mail server for centurytel.net.  what you are doing is manually making this connection.
Okay, I hope I did this right?

I opened a telnet session and used:

open my-server-ip 25   "Where I placed my actual server IP"

then

ehlo 209.142.136.228

I completed the rest of the telent adding a subject and body text.

I checked the badmail folder and it was in there.

Did I follow this correctly?

ah ok.  actually you want to get onto the console of that server.  open the cmd prompt on that server.  then you want to open the telnet and open to the 209.142.136.228 address.  your server ip shouldnt go in there anywhere.
Okay, I opened my command console on my server and started a telnet session.  I typed in:

open 209.142.136.228 25

mail from:dwayneepps@centurytel.net

I got a rejected error message.

Am I correct in assuming the remote server isn't accepting my request?  If so, how do I go about to correct that?
you did an EHLO first right?  if so, then yes the remote server is rejecting your email.  what is the error that its giving you?  (you can right click -> mark to highlight text, then hit [enter] to copy to clipboard)
yes, I after I opened the connection to the remote server, I typed in:

ehlo yahoo.com

then I typed in:

mail from:dwayneepps@centurytel.net

that's when I received the error message:

553 5.3.0 'my_dynamic_ip_address' rejected http://www.njabl.org/cgi-bin/lookup.cgi?query='my_dynamic_ip_address'
did you try visiting the link?  please post what that page tells you.
This is the information from the link:

please note: I didn't think it was a good idea to post the ip for security since that is the ip I'm using.

Here is the result of your query:

'my_dynamic_ip_address' is listed in dynablock.njabl.org.

'my_dynamic_ip_address' resolves to 'my_dynamic_ip_address'.dyn.centurytel.net



click here to request removal and retesting of this IP.
click here to see if 'my_dynamic_ip_address' is in other dnsbls.


--------------------------------------------------------------------------------
This IP has not been tested.
>>please note: I didn't think it was a good idea to post the ip for security since that is the ip I'm using.

not a problem at all.  somehow your ip address has gotten listed on a black list.  try following that link to request that your ip be removed.  it may take a little while though to get it freed up.  i would also check that second link to see that you arent on any other black lists.
Okay, those ip's are automatically assigned to me from my ISP.  So, anytime I reboot my PC, I'll have a new IP.

So, basically I'll constantly be blacklisted.

What I don't understand, is I have been using smtp mail server in IIS to test my CDO mail scripts for several years.  Why all of the sudden would a block of IP's from my ISP be blacklisted?

I don't understand, why would it be working and then stop?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, since I can't get this to work with my dynamic IP from my ISP, is it possible to do the following.

I have a home LAN setup, three PC's running XP, Win 2000 Pro and 2000 server...all behind my router.  I get my dynamic IP from my ISP, but my server is set to a static IP just within my home network.  I have IIS and DNS running on my server.

Can I setup my smtp mail server within IIS to work within my home network to test my mail scripts and relay email messages just within my network.  I'm just trying to see if I can setup this up internally for testing purposes using the mails sripts I develop.  Thereby, avoiding the need for a remote email server to relay my email.

Not being very familiar with smtp setup, I wasn't sure if this was possilble?
I still feel like this is being over-complicated. I still would bet that if you used the code below, and left off the entire CDO.Configuration that it would work just fine.

<%
Sub SendMessage(strTo, strFrom, strSubject, strBody)
     Set oCDO = Server.CreateObject("CDO.Message")
          With oCDO
               .To       = strTo
               .From     = strFrom
               .Subject  = strSubject
               .HtmlBody = strBody
               .Send
          End With
     Set oCDO = Nothing
End Sub
%>

Hi peterxlane...thanks for replying to my post.  I did give your suggestion a try, but the mail still fails and is depoisted into the badmail folder.

I might be mistaken, but I believe I still have to have an ip for the smtp server in order to relay the message.

Thanks for your help.  I appreciate it.
Regards,
-D-
try contacting your isp to see if they have an smtp mail server that you can relay through.  more than likely they will not be on any black lists.