Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i configure email using smtp and i am getting exception that "Transaction failed. The server response was: m1pismtp01-025.prod.mesa1.secureserver.net" .is my smtp host and port no are correct.if any settings required in webconfig file suggest to me please.

try
{
if (!string.IsNullOrEmpty(headers) && !string.IsNullOrEmpty(subject) && !string.IsNullOrEmpty(messageBody))
{
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();

using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())
{
msg.Subject = subject;
msg.Body = "<html><body>" + "

Name :" + context.Request["Name"] + "

" + "

Email :" + context.Request["email"] + "

Message :" + context.Request["message"];
msg.From = new System.Net.Mail.MailAddress("hello@XXX.in", "XXX enquiry");
msg.To.Add("hello@XXX.in");
msg.IsBodyHtml = true;
smtp.Host = "smtp.xxx.in";
System.Net.NetworkCredential basicauthenticationinfo = new System.Net.NetworkCredential("hello@XXX.in", "pwd");
smtp.Port = int.Parse("25");
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = basicauthenticationinfo;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;

smtp.Send(msg);
isvalid = true;
}
}
}

Posted

1 solution

Let's see… int.Parse("25");… are you serious?

Here is my best advice: you should stop doing what you are doing and start learning programming starting from the very basics: object and types, variable and expression, methods and their parameters. Avoid developing anything complex: no UI except simple console-only applications, no networks, nothing cool. You are not ready yet.

This is really serious. If you are not going to follow my advice, you won't get anything except big frustration and gross loss of time.

—SA
 
Share this answer
 
Comments
laxmi smiley 19-Feb-14 5:07am    
i tried smtp.port=25;
but still same exception
Sergey Alexandrovich Kryukov 19-Feb-14 10:34am    
(Sigh...)
You cannot learn anything like this, you need to follow my advice.
—SA

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