tags:

views:

26

answers:

1

Hi all

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 = 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 can it be exactly.

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

thanks

A: 

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

Guildencrantz
Thanks a lot dude, it finally worked
Mina Samy