Steve Bohler
asked on
Error sending out email with CDO.Message
Our ASP VBscript programs that send out an email (like from a contact form) have worked perfectly for years. Suddenly, the .Send function is generating an error 80040211.
Again, nothing to our knowledge has changed.
Is there a way to see what the specific error may be?
Again, nothing to our knowledge has changed.
Is there a way to see what the specific error may be?
ASKER
Well, I am using CDO.Message and sending it through a remote Exchange server on port 25.
I just restarted the IIS SMTP service anyway, but it didn't remedy the situation.
I just restarted the IIS SMTP service anyway, but it didn't remedy the situation.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is the message that is sent always the same?
Is it happening on every form submission or just some?
If some, can you tell what the difference is?
What is your SMTP provider? Did two factor auth get turned on?
Perhaps port 25 was blocked. Can you use an alternative port?
Is it happening on every form submission or just some?
If some, can you tell what the difference is?
What is your SMTP provider? Did two factor auth get turned on?
Perhaps port 25 was blocked. Can you use an alternative port?
ASKER
Scott,
Thanks for your reply.
The message is slightly different in each one.
It happens on every form submission.
SMTP provider server is east.EXCH032.serverdata.ne t
I'm checking to see if port 25 is blocked. But it does seem to work if telnet to the server and open port 25.
Thanks for your reply.
The message is slightly different in each one.
It happens on every form submission.
SMTP provider server is east.EXCH032.serverdata.ne
I'm checking to see if port 25 is blocked. But it does seem to work if telnet to the server and open port 25.
I'd still suggest to configure the CDO to save to a file instead of sending and visually inspect the message's headers and body. It might be too big, or something else is wrong.
ASKER
zc2,
Not sure how to do that, unfortunately.
Steve
Not sure how to do that, unfortunately.
Steve
just set any folder to the ""http://schemas.microsoft.com/cdo/configuration/nntpserverpickupdirectory" configuration variable and comment out the line which sets the "http://schemas.microsoft.com/cdo/configuration/smtpserver" variable.
Sorry, wrong property. Use "http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"
put it a path to an existing folder, not to a file.
Also, the "http://schemas.microsoft.com/cdo/configuration/sendusing" need to be changed.
put it a path to an existing folder, not to a file.
Also, the "http://schemas.microsoft.com/cdo/configuration/sendusing" need to be changed.
ASKER
OK, made the edits. Still nothing in the folder though. Am I missing a step?
Just tried, a file was created in my "D:\temp\"
With cdoConfig.Fields
.Item(cdoURL & "sendusing") = 1 ' <-- this switches from TCP/IP mode to the pickup mode
' .Item(cdoURL & "smtpserver") = "east.xxx.xxx.net"
.Item(cdoURL & "smtpserverpickupdirectory")="d:\temp\"
.Item(cdoURL & "smtpserverport") = 25
.Item(cdoURL & "smtpauthenticate") = 1
.Item(cdoURL & "sendusername") = "dummyaccount@xxxxx.com"
.Item(cdoURL & "sendpassword") = "xxxxxxxxx"
.Item(cdoURL & "smtpusessl") = 1
.Item(cdoURL & "smtpconnectiontimeout") = 60
.Update
End With
ASKER
OK, I've got that working.
What should I do with the files it is creating?
What should I do with the files it is creating?
First check the file size. Is it greater than the exchange's limit? Then open in a text editor and look for long not wrapped lines.
To send them further to the recipient move them to the IIS SMTP's pickup folder. Usually it's C:\inetpub\mailroot\pickup \
To send them further to the recipient move them to the IIS SMTP's pickup folder. Usually it's C:\inetpub\mailroot\pickup
ASKER
No, they're small and typical of the ones that go out fine. I moved them over to the IIS SMTP pick up folder and they went out fine.
Is there a way to have them put into the correct pickup directory so they're processed by the local smtp server and not our remote Exchange server? Is there a problem with doing it that way (since it seems that the local smtp server is not having a problem with it)?
Is there a way to have them put into the correct pickup directory so they're processed by the local smtp server and not our remote Exchange server? Is there a problem with doing it that way (since it seems that the local smtp server is not having a problem with it)?
Just put the correct folder to that CDO config property:
.Item(cdoURL & "smtpserverpickupdirectory")="C:\inetpub\mailroot\pickup\"
Is there a problem with doing it that wayAs I said earlier, that's a way I would recommend. I use that approach in all my projects, no issues so far.
ASKER
If I use that directory, I get an Access Denied error in my code.
Just give to the directory proper writing permissions to the user/group your process is running as/belongs to.
For an example, if your ASP's application pool working as "Application pool identity", you could grant a modifying permission to the whole IIS_IUSRS group:
For an example, if your ASP's application pool working as "Application pool identity", you could grant a modifying permission to the whole IIS_IUSRS group:
icacls C:\inetpub\mailroot\pickup /grant IIS_IUSRS:M
ASKER
OK, it's at the point where it writes to the pickup folder and then the file disappears. But, I'm not receiving the emails in my inbox (the test emails are to go to me). Hmmmmm
ASKER
It seems it allows emails to go out when from one domain, but not another. Is there a place where I can control that?
Check, are those were not delivered stuck in the Queue folder (C:\inetpub\mailroot\Queue ) or discarded as badmail and placed to C:\inetpub\mailroot\Badmai l
Make sure that the SMTP service has the logging enabled and all the logging fields are included, then check the SMTP log files, it could have a clue what is wrong.
Make sure that the SMTP service has the logging enabled and all the logging fields are included, then check the SMTP log files, it could have a clue what is wrong.
ASKER
Thanks.
Turned out the emails sent from one address were being flagged as spam by my email provider.
Where do I set logging?
Turned out the emails sent from one address were being flagged as spam by my email provider.
Where do I set logging?
Launch Administrative Tools/Internet Information Services (IIS) 6.0 Manager
Open the properties dialog for your SMTP virtual server
Make sure the checkbox "Enable logging" is checked
Click "Properties"
Note the Log file directory
Switch to the Advanced tab
Make all the checkboxes checked.
Open the properties dialog for your SMTP virtual server
Make sure the checkbox "Enable logging" is checked
Click "Properties"
Note the Log file directory
Switch to the Advanced tab
Make all the checkboxes checked.
ASKER
Ok, I’ll try that.
Is it possible to relay email from the smtp server over to our remote exchange server?
Is it possible to relay email from the smtp server over to our remote exchange server?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Turned out the emails sent from one address were being flagged as spam by my email provider.If these are only ever going to you, it will be fine. If you are going to be sending anything to clients/visitor using CDO you will really be better off using a 3rd party smtp service like sendgrid to increase deliverable rates.
ASKER
Thanks so much!!!
ASKER
I'm running into emails now in the Badmail folder since adding a smart host. Do you know how I can remove that? If I just clear out the field, the OK button becomes inactive.
Try to analyze the SMTP log and find the reason why those were not delivered. If you see some error in the log but can't interpret, post that here, may be we could help.
BTW, I'd recommend to use the pickup service instead of TCP/IP connection to the SMTP service. So you could visually inspect the formed email and try to analyze what's wrong with it. It could bee too beg (bigger that the server's limit) or exceeds some other limitations.