hi,
i want to send an email in my project.when i use the SMTPMail.send() method there will be an unhandled exception error will occur.how can i solve this.
Thank you
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
krithika muthukrishnanPosted Feb 10, 2011, 12:51 AM
when i send a mail in .net using local host.i got the error
error : Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email protected]
i perform the relay operation in iis also,but now the same error will occur,how can i solve this,
thanks
krithika muthukrishnanPosted Feb 9, 2011, 5:02 AM
when is send the mail using local host.The page has only one server side form tag error will occur.how can i solve this.
CrishPosted Feb 8, 2011, 8:01 AM
if you are using localhost for sending mails then it can not send and giving you error. You need to do configure IIS for sending emails in locally or write
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; before Send() method.
It will send mail using asp.net code.
Guest UserPosted Feb 8, 2011, 7:04 AM
Steps for send a mail .
1). Add this code in your Web.Config file:
Add these code in your email.cs file
2). add this namespace: using System.Net.Mail;
3).MailMessage msg = new MailMessage();
msg.From = new MailAddress("[email protected]");
msg.To.Add([email protected]);
msg.Subject = "This mail from CsharpCorner";
msg.body="Your Text Here ";
msg.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = ConfigurationManager.AppSettings["SMTP"];
smtp.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["FROMEMAIL"], ConfigurationManager.AppSettings["FROMPWD"]);
smtp.EnableSsl = true;
smtp.Send(msg);
may be this is helpful to u
Krishna GaradPosted Feb 8, 2011, 5:54 AM