Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am sending mails through SMTP. My requirement is I need to send mails from two mail Id's. From some piece of code i need to send mail from "abc@mydomain.com" and from some piece of code i need to send mail from "xyz@mydomail.com". Is this possible through SMTP??

I am able to send email form one email id, but unable to send mail through another mail id.

Below is my code.

SmtpClient objSmtp = new SmtpClient("pod51021.outlook.com");
System.Net.NetworkCredential("abc@mydomain.com", "abc123");
objSmtp.EnableSsl = false;
objSmtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
objSmtp.UseDefaultCredentials = false;
MailMessage message = new MailMessage();
message.From = new MailAddress("abc@mydomain.com");
message.To.Add("abc@gmail.com");
message.Subject = "Hi";
message.Body = "Hi";
message.IsBodyHtml = true;
ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
objSmtp.Send(message);

This code works fine for one mail id.

But when i use second mail id, mail is going to BadMail direcory. The error message in BDR file is "
XML
Unable to deliver this message because the follow error was encountered: "This message is a delivery status notification that cannot be delivered.".

The specific error code was 0xC00402C7.


The message sender was <>.

".

Please help me to resolve this issue.

Thanks in Advance.
Posted
Comments
Ramya SV 1-Apr-13 3:32am    
Please help...

1 solution

 
Share this answer
 
Comments
Ramya SV 1-Apr-13 7:54am    
Thank you. But it did not provide any solution.
Richard MacCutchan 1-Apr-13 11:23am    
Then you need to do some more research and debugging to find out exactly what is happening when this error occurs.
Ramya SV 2-Apr-13 1:32am    
I tried a lot but didn't find any solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900