Click here to Skip to main content
15,921,694 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I'm getting the error "Transaction failed. The server response was: m1pismtp01-005.prod.mesa1.xxx.net" when i want to send the mail using the SMTP Client.

I used the below code.

C#
MailMsg            = new MailMessage();
MailMsg.IsBodyHtml = true;

 
TheCredential      = new System.Net.NetworkCredential("xxxxx", "xxxx");

 
MailMsg.From       = new MailAddress("xxxxxx");
MailMsg.Priority   = MailPriority.Normal;

 
SMTPClient = new System.Net.Mail.SmtpClient("xxxxxx", 25);

 
ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
{ 
    return true; 
};

 
SMTPClient.UseDefaultCredentials = false;
SMTPClient.Credentials = TheCredential;
SMTPClient.EnableSsl = false;

 
MailMsg.IsBodyHtml = true;
MailMsg.To.Add(To);
MailMsg.Subject = Subject;
string htmlBody = Body;

 
AlternateView htmlView = AlternateView.CreateAlternateViewFromString
                         (htmlBody, 
                          null, 
                          MediaTypeNames.Text.Html);
MailMsg.AlternateViews.Add(htmlView);

 
try
{
    MailMsg.BodyEncoding = System.Text.Encoding.UTF8;
    SMTPClient.Send(MailMsg);
    return "Mail Sent Successfully";
}
catch(Exception ex)
{
}


Thank in advance
Posted
Updated 9-Feb-11 2:42am
v2
Comments
#realJSOP 9-Feb-11 8:44am    
You didn't provide the entire server response.

1 solution

The most likely and common reason is a relay issue, meaning the SMTP server you are trying to use has not been configured to relay email.

Note that this is a best guess, since you haven't provided the actual SMTP error message.
 
Share this answer
 
v2

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