Tuesday 25 December 2012

Send Email in asp.net c#


public void SendMail(string FromEmail, string ToEmail, string Subject, string Body)
    {
        System.Net.Mail.MailMessage eMail = new System.Net.Mail.MailMessage();
        eMail.From = new System.Net.Mail.MailAddress(FromEmail);
        eMail.To.Add(ToEmail);
        eMail.Subject = Subject;
        eMail.IsBodyHtml = true;
        eMail.Body = Body;
        System.Net.Mail.SmtpClient SMTP = new System.Net.Mail.SmtpClient();
       SMTP.Send(eMail);    
        eMail.Dispose();
    }


Web.Config:
 <system.net>
 <mailSettings> 
<smtp> 
<network host="your stmp server" port="25" userName="your from email" password="your password"/> 
</smtp> 
</mailSettings> 
</system.net>

No comments:

Post a Comment

If any doubt?then please comment in my post

How to reduce angular CLI build time

 Index: ----- I am using angular cli - 7 and I am going to tell how to reduce the build time as per my knowledge. Problem: -------- Now the ...