barryfandango
asked on
CDOSYS Woes
I'm putting all my points on this one in the hopes that i can finally get some questions answered about my CDOSYS problems. I've been writing applications for my employer that send emails programmatically, and I've been using CDOSYS. While experimenting with the package I discovered a major problem : that there seemed to be a difference between the emails sent to people within the company (our mail is provided by an MS exchange 5.5 server) and those sent to addresses outside of the company (I am guessing because they are outside of our firewall, but i don't know.)
After endless experimentation and frustration i discovered that a CDO.Message that referenced our main server (NT server 4 with MS exchange 5.5) as it's mail server would deliver messages internally to the company. Another machine on the network, running IIS and win2k, would deliver external messages when referenced. (to be thorough: the NTS machine cannot deliver external mail, and the win2k machine cannot deliver internal mail.)
Given a long list of emails, it's a pretty big pain in the butt for every program that i write to have to sort them into local and external addresses, then send the messages to two different servers.
Not only this : as of three days ago, the computer that I use to send external messages stopped working. The emails began bouncing back with the error message "Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server."
I would like to get to the bottom of all this trouble and just use one mail server to send emails programmatically, something that is supposed to be easy with CDOSYS. Below is a sample of the code I use to send messages. The successful answer will receive 385 points + my eternal gratitude.
-------------------------- ---------- ----------
Set extMailConfig = New CDO.Configuration
Set Flds = extMailConfig.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = (win2k/IIS Machine)
.Item(cdoSMTPConnectionTim eout) = 30
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPAuthenticate) = cdoAnonymous
.Update
End With
Set intMailConfig = New CDO.Configuration
Set Flds = intMailConfig.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = (NTS4.0/Exchange Machine)
.Item(cdoSMTPConnectionTim eout) = 30
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPAuthenticate) = cdoAnonymous
.Update
End With
' Send an external message.
Set extMail = New CDO.Message
With extMail
Set .Configuration = extMailConfig
.bcc = bcc
.To = externaladdress@externalse rver.com
.From = mailfrom
.Subject = "test"
.TextBody = "This is a test."
.Send
End With
' send a local message.
Set intMail = New CDO.Message
With intMail
Set .Configuration = intMailConfig
.bcc = bcc
.To = localaddress@myserver.com
.From = mailfrom
.Subject = "test"
.TextBody = "This is a test."
.Send
End With
-------------------------- ---------- ---------- ---------- -
After endless experimentation and frustration i discovered that a CDO.Message that referenced our main server (NT server 4 with MS exchange 5.5) as it's mail server would deliver messages internally to the company. Another machine on the network, running IIS and win2k, would deliver external messages when referenced. (to be thorough: the NTS machine cannot deliver external mail, and the win2k machine cannot deliver internal mail.)
Given a long list of emails, it's a pretty big pain in the butt for every program that i write to have to sort them into local and external addresses, then send the messages to two different servers.
Not only this : as of three days ago, the computer that I use to send external messages stopped working. The emails began bouncing back with the error message "Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server."
I would like to get to the bottom of all this trouble and just use one mail server to send emails programmatically, something that is supposed to be easy with CDOSYS. Below is a sample of the code I use to send messages. The successful answer will receive 385 points + my eternal gratitude.
--------------------------
Set extMailConfig = New CDO.Configuration
Set Flds = extMailConfig.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = (win2k/IIS Machine)
.Item(cdoSMTPConnectionTim
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPAuthenticate)
.Update
End With
Set intMailConfig = New CDO.Configuration
Set Flds = intMailConfig.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = (NTS4.0/Exchange Machine)
.Item(cdoSMTPConnectionTim
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPAuthenticate)
.Update
End With
' Send an external message.
Set extMail = New CDO.Message
With extMail
Set .Configuration = extMailConfig
.bcc = bcc
.To = externaladdress@externalse
.From = mailfrom
.Subject = "test"
.TextBody = "This is a test."
.Send
End With
' send a local message.
Set intMail = New CDO.Message
With intMail
Set .Configuration = intMailConfig
.bcc = bcc
.To = localaddress@myserver.com
.From = mailfrom
.Subject = "test"
.TextBody = "This is a test."
.Send
End With
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
MCummings,
I added a remote domain to the SMTP server on the win2k machine called myserver.com and set it to "forward all mail to the smart host :" to the IP of the exchange server. It works - the mail sent to my local address arrived. 50% done - the external mail is still not delivering.
I added a remote domain to the SMTP server on the win2k machine called myserver.com and set it to "forward all mail to the smart host :" to the IP of the exchange server. It works - the mail sent to my local address arrived. 50% done - the external mail is still not delivering.
How do you have the default SMTP Domain configured?
Check your SMTP Directories, is the mail going into you outgoing directory?
Check your SMTP Directories, is the mail going into you outgoing directory?
ASKER
The messages are appearing in the "Queue" directory as EML files. I receive delay notifications from the server about them, instructing me not to re-send. Eventually i recieve a failure notification. At that point i believe the messages are turned into BDP, BAD and BDR files and moved into the "Badmail" directory.
ASKER
As for the configuration of the domain, there doesn't appear to be very much configuration to do... Opening the Properties of the local domain brings up a window with one option, about the location of the drop directory. As for the configuration of the SMTP server itself:
General:
IP Address : all unassigned, TCP Port 25
Access:
Authentication : Set to Anonymous only
Secure Communication : do not require a secure channel,
no certificate installed.
Connection Control : allow all
Relay Restrictions : allow all
Messages:
No limits set. Non-delivery reports go to my address (a local one.)
Delivery:
Outbound Security : Anonymous Access
Expirations / timeouts etc set to default
LDAP : disabled
General:
IP Address : all unassigned, TCP Port 25
Access:
Authentication : Set to Anonymous only
Secure Communication : do not require a secure channel,
no certificate installed.
Connection Control : allow all
Relay Restrictions : allow all
Messages:
No limits set. Non-delivery reports go to my address (a local one.)
Delivery:
Outbound Security : Anonymous Access
Expirations / timeouts etc set to default
LDAP : disabled
Ok, 2 more questions:
1) What reason (if any) is given for the message being returned?
2) Can you (from the SMTP server) resolve the SMTP domains of the recipients you are trying to send to? (Ping, nslookup, etc...)
1) What reason (if any) is given for the message being returned?
2) Can you (from the SMTP server) resolve the SMTP domains of the recipients you are trying to send to? (Ping, nslookup, etc...)
ASKER
Here is the mail that gets returned to me:
--------------------------
This is an automatically generated Delivery Status Notification.
Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server.
xxx@hotmail.com
-------------------------- -
Extra info : if i open the "Computer Management -> Event Viewer -> System" there are a pile of warning items from SMPTSVC, event type 4000, with the message "Message delivery to the remote domain 'coair.com' failed for the following reason: %2 " (Not very helpful.)
Using nslookup i am able to resolve the domains of various servers that i am trying to mail to.
Stranger and stranger : last night my co-worker installed some hotfixes on the SMTP server. This morning i discovered that the SMTP server has changed to its previous state - it would send mail externally but not internally. Then i rebooted it, and now both work. So the problem is fixed, though i'm jittery since it broke for no apparent reason and now has fixed itself just as mysteriously. Thanks for your help MCummings, you earned the points.
For future reference to any knowledge seekers - the hotfixes installed on the server were as follows :
Windows 2000 Hotfix Q313450
Windows 2000 Hotfix Q320206
Windows 2000 Hotfix Q314147
Windows 2000 Hotfix Q300845
Windows 2000 Hotfix Q313829
Windows 2000 Hotfix Q319733
Windows 2000 Hotfix Q311967
Windows 2000 Hotfix Q313582
--------------------------
This is an automatically generated Delivery Status Notification.
Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server.
xxx@hotmail.com
--------------------------
Extra info : if i open the "Computer Management -> Event Viewer -> System" there are a pile of warning items from SMPTSVC, event type 4000, with the message "Message delivery to the remote domain 'coair.com' failed for the following reason: %2 " (Not very helpful.)
Using nslookup i am able to resolve the domains of various servers that i am trying to mail to.
Stranger and stranger : last night my co-worker installed some hotfixes on the SMTP server. This morning i discovered that the SMTP server has changed to its previous state - it would send mail externally but not internally. Then i rebooted it, and now both work. So the problem is fixed, though i'm jittery since it broke for no apparent reason and now has fixed itself just as mysteriously. Thanks for your help MCummings, you earned the points.
For future reference to any knowledge seekers - the hotfixes installed on the server were as follows :
Windows 2000 Hotfix Q313450
Windows 2000 Hotfix Q320206
Windows 2000 Hotfix Q314147
Windows 2000 Hotfix Q300845
Windows 2000 Hotfix Q313829
Windows 2000 Hotfix Q319733
Windows 2000 Hotfix Q311967
Windows 2000 Hotfix Q313582
Guys,
Have you checked to see that the computer you are working from is allowed to relay messages through the SMTP server you are using.
I have a web app that is doing a similar thing and was only able to get messages internally until I went to the mail server (exchange 2000 sp3) and went to "smtp virtual server" >> "properties" >> "access" >> "relay" and granted relay permission to the server that my web-app was on. once I did that the messages started getting through.
This is probably diabled so external people don't connect to the smtp server and broadcast spam messages.
Anyway, it worked for me. Hope it works for y'all.
Cheers from Austin.
Have you checked to see that the computer you are working from is allowed to relay messages through the SMTP server you are using.
I have a web app that is doing a similar thing and was only able to get messages internally until I went to the mail server (exchange 2000 sp3) and went to "smtp virtual server" >> "properties" >> "access" >> "relay" and granted relay permission to the server that my web-app was on. once I did that the messages started getting through.
This is probably diabled so external people don't connect to the smtp server and broadcast spam messages.
Anyway, it worked for me. Hope it works for y'all.
Cheers from Austin.
ASKER