Search code examples
asp-classiccdo.message

CDOSYS : how to check if it's working?


On a client server, we have a little script that send an email at the end of an order, just before closing it.

Until yesterday everything works fine, but suddenly, the page gives a generic 500 error. so I start from the bottom of the page find that if I put a response.end just before the .send of the cdo mail function, the page works fine:

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.theserver.com" 
Flds(cdoSMTPServerPort) = 25
Flds(cdoSMTPAuthenticate) = cdoAnonymous '0
Flds.Update             

With iMsg
    Set .Configuration = iConf                        
         .To = "[email protected]"
         .From = "[email protected]"
         .Sender = ""
         .Subject = "test"                   
         .HTMLBody = "TEST"
         RESPONSE.END()
         .Send
End With

On the page there are also two lines at the beginning:

<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Type Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->

Well, I’ve already done some test putting some script to send emails a little different from this one but nothing seems to work. Does anybody know a way to test the cdosys? Something that. I don't know, return the version... or a list of options... well, something that makes me know that the error is on the server (and so I could phone to them and tell "hey it's not my fault")...?

Edit: Since the page gives only a 500 error, is there a way to makes the server returns a more specific error code? i can't access the server, but only the ftp (so only classic asp)

Edit 2: i have add this code:

on error resume next
.Send
If Err.Number <> 0 Then
Response.write(Err.Number)
response.write("<br>")
response.write(Err.description)
end if

and it gives this message:

-2147220975 Impossibile inviare il messaggio al server SMTP. Codice errore di trasporto: 0x800ccc6f. Risposta del server: 554 Your access to this mail system has been rejected due to the sending MTA's poor reputation.


Solution

  • Based on your error message the CDO component is working but your SMTP sever (MTA) is rejecting the message. Maybe because of the .gov domain? Regardless you have a poor SMTP reputation for spamming. You need to use a different SMTP server. If you are using the ip of the IIS server, than that IP is no longer good, and has been blacklisted by spam servers.

    Mailchimp has a lot of information on mail deliverable. Take a look at it. You can use a hosted SMTP service (mailgun, sendgrid, mandrill), all of which will block you right away if you are spamming.