SmtpClient smtp = new SmtpClient(pSMTP);
smtp.Credentials = new NetworkCredential(SendEmail, pPass);
//Create the MailMessage object
MailMessage msg = new MailMessage();
//Assign from address
msg.From = new System.Net.Mail.MailAddress(pFromEmail);
//Assign to address
msg.To.Add(new System.Net.Mail.MailAddress(pTo));
if (pCc.Trim() != "")
{
msg.CC.Add(new System.Net.Mail.MailAddress(pCc));
}
//smtp.EnableSsl = true;
//assign subject, and body
msg.Subject = pSubject;
msg.Body = pBody;
msg.IsBodyHtml = Convert.ToBoolean(pFormat);
if (pAttachmentPath.Trim() != "")
{
msg.Attachments.Add(new System.Net.Mail.Attachment(pAttachmentPath));
}
//Send the message with SmtpClient
smtp.Host = "localhost";
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtp.Send(msg);
return true;