1
Answer

problem in smtp mail sending

hi
  this is my coding

using
System.Net.Mail;

 

 

public partial class email : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

SmtpClient smtpClient = new SmtpClient();

MailMessage objMail = new MailMessage();

MailAddress objMail_fromaddress = new MailAddress("[email protected]");

//MailAddress objMail_fromaddress = new MailAddress(txtFrom.Text, "Learnxpress Support");

MailAddress objMail_toaddress = new MailAddress("[email protected]");

objMail.From = objMail_fromaddress;

objMail.To.Add(objMail_toaddress);

objMail.Subject = "E-mail Example - CSharp - Text";

objMail.Body = "Name: ";

objMail.IsBodyHtml = true;

objMail.Priority = MailPriority.High;

smtpClient.Host = "localhost";

smtpClient.Credentials = new System.Net.NetworkCredential("[email protected]", "cccc");

try

{

smtpClient.Send(objMail);

Response.Write("send successfully");

}

catch (SmtpException exc)

{

Response.Write("Send failure: " + exc.ToString());

}

 

}

}

my error is
Send failure: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email protected] at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at email.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\ramamoorthy\My Documents\Visual Studio 2005\WebSites\mail\email.aspx.cs:line 34

 please help me

Answers (1)