views:

41

answers:

1

I'm writing an application in classic ASP (yes, please forgive me) that sends e-mails using Google Mail. I have it working just fine like this:

Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message") 

ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = SendUsername
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SendPassword
ObjSendMail.Configuration.Fields.Update

ObjSendMail.To = "[email protected]"
ObjSendMail.From = "[email protected]
ObjSendMail.Subject = "subject here..."
ObjSendMail.HTMLBody = "body here..."

'ObjSendMail.Fields("urn:schemas:mailheader:disposition-notification-to") = SendUsername
'ObjSendMail.Fields("urn:schemas:mailheader:return-receipt-to") = SendUsername
'ObjSendMail.Fields.Update
'ObjSendMail.DSNOptions = 14
ObjSendMail.Send
Set ObjSendMail = Nothing

When I uncomment out the following lines:

'ObjSendMail.Fields("urn:schemas:mailheader:disposition-notification-to") = SendUsername
'ObjSendMail.Fields("urn:schemas:mailheader:return-receipt-to") = SendUsername
'ObjSendMail.Fields.Update
'ObjSendMail.DSNOptions = 14

The e-mail fails to send. No error, just no e-mail and no delivery receipt. I can't figure out for the life of me how to make this work. "SendUsername" is a valid e-mail address. Any help would be appreciated.

A: 

Its probably not working because Gmail doesn't want you doing this. This sort of thing is often explioted by spammers.

AnthonyWJones
I get a delivery failure notice, but not a delivery success notice. I'm not sure how one can lead to an exploit, but not the other.
Sparafusile
@Sparafusile: Its not uncommon for destination SMTP server to ignore delivery success notification request. If you look at the spec DSN is only requesting this feature the SMTP servers are not obliged to honor it. In the real world imagine the extra load all that potential messaging would represent.
AnthonyWJones
@AnthonyWJones - Ok, so the SMTP decides not to send a delivery receipt, fine. Why isn't the code above even sending the e-mail in the first place? Is there an error in the code that's preventing it from working even though I wouldn't ever get the desired result?
Sparafusile