User needs to pass few parameter to this method to send the mail.
body - Content of email that you want to send.
toadd - Address of the user to whom you want to send the Email.
ccAdd - Address of the user to whom you want to send Email in CC.
bccadd -Address of the user to whom you want to send Email in BCC.
fromaddm - Address of the user that want to send the Email.
subject - Subject of the Email.
attachment - Attachment any if you want to send to user otherwise set the value as blank if you don't want to send any email.
Address of SMTP Server - Replace this text with the address of your SMTP Server.
Code To Send Email:
public static bool SendMail(string body, string toadd, string fromadd, string subject, string attachment, string ccAdd, string bccadd)
string mailServerName = "Address of SMTP Server ";
//MailMessage represents the e-mail being sent
using (MailMessage message = new MailMessage(fromadd, toadd, subject, body))
if (attachment != "")
if (bccadd != "")
message.IsBodyHtml = true;
message.Priority = MailPriority.Normal;
SmtpClient mailClient = new SmtpClient();
mailClient.Host = mailServerName;
mailClient.UseDefaultCredentials = true;
catch (SmtpException ex)
catch (Exception ex)
}Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator