Hi,
Try below code snippet for sending an authenticated email.
public bool Send(string fromAddress, string fromText, string toAddress, string toText, string bccAddress, string bccText, string subject, StringBuilder plainBody, StringBuilder htmlBody)
{
try
{
string strUname = "";
string strpw = "";
string sSmtpHost = "";
oMail.From = new MailAddress(fromAddress, fromText);
oMail.To.Add(new MailAddress(toAddress));
oMail.Bcc.Add(new MailAddress(bccAddress));
oMail.Subject = subject;
oMail.Body = htmlBody.ToString();
oMail.IsBodyHtml = true;
SmtpClient oSmtp = new SmtpClient(sSmtpHost);
oSmtp.Credentials = new System.Net.NetworkCredential(strUname, strpw);
oSmtp.EnableSsl = false;
oSmtp.Send(oMail);
return true;
}
catch (Exception Ex)
{
throw new Exception("Sending E-Mail failed." + Ex.Message.ToString(), Ex);
}
}