hi dear,
Please use below secure mail function
public bool SendEmialWithSecure(string ToEmailId, string FromEmailId, string FromName, string SenderEmailId,
string SenderName, string Subject, string MailBody, string SMTPHost, Int32 SMTPPort,
string CredentialEmailId, string CredentialPassword, string strAttachment)
{
System.Net.Mail.MailMessage ResetPassMail = new System.Net.Mail.MailMessage();
SmtpClient SmtpServer = new SmtpClient();
ResetPassMail.To.Add(new MailAddress(ToEmailId));
ResetPassMail.From = new MailAddress(FromEmailId, FromName);
ResetPassMail.Sender = new MailAddress(SenderEmailId, SenderName);
ResetPassMail.Subject = Subject;
ResetPassMail.IsBodyHtml = true;
ResetPassMail.Body = MailBody;
ResetPassMail.Priority = System.Net.Mail.MailPriority.High;
Attachment attach = new Attachment(strAttachment);
ResetPassMail.Attachments.Add(attach);
SmtpServer.Host = SMTPHost;
SmtpServer.Port = SMTPPort;
SmtpServer.Credentials = new NetworkCredential(CredentialEmailId, CredentialPassword);
SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
try
{
SmtpServer.Send(ResetPassMail);
return true;
}
catch (Exception ex)
{
throw ex;
}
}