开发者

Not receiving Delivery notifications in CDO

开发者 https://www.devze.com 2022-12-25 10:15 出处:网络
I have a function that uses CDO to send emails with request to have a delivery receipt when the mail reacehes the recepient.

I have a function that uses CDO to send emails with request to have a delivery receipt when the mail reacehes the recepient.

I use the following code:

CDO.Message msg开发者_JAVA技巧 = new CDO.Message();
CDO.Configuration conf = new CDO.Configuration();

conf.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value = 1;
conf.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = txtHost.Text;
conf.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"].Value = 25;
conf.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value = txtPass.Text;
conf.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value = txtUser.Text;

conf.Fields.Update();

msg.Configuration = conf;

msg.To       = txtTo.Text;
msg.From     = txtFrom.Text;
msg.Subject  = txtSubject.Text+" " + DateTime.Now;
msg.HTMLBody = txtBody.Text;
msg.BodyPart.Charset = "utf-8";

msg.DSNOptions = CdoDSNOptions.cdoDSNSuccessFailOrDelay;
msg.Fields.Update();
msg.Send();

Now this works fine on my local machine with my web server, but when used in the production server with another mail server the delivery receipts were not received.

I believe there must be a difference between my mail server and the production mail server but I don't know what it can be exactly.

So please if anybody has faced such a problem before, tell me what to do.


It works on your local machine almost by accident because you're delivering it to yourself. To work out in the world you have to explicitly tell CDO not to deliver to the local smtp for relaying by specifying sendUsingPort

conf.Fields["ttp://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2

0

精彩评论

暂无评论...
验证码 换一张
取 消