发邮件

    private bool SendMail(string systemEmail, string emailAddress, string subject, string body, bool isBodyHtml)
    
{
        
try
        
{
            MailMessage message 
= new MailMessage(systemEmail, emailAddress);
            message.Subject 
= subject;
            message.Body 
= body;
            message.IsBodyHtml 
= isBodyHtml;//true;

            SmtpClient client 
= new SmtpClient();
            client.Host 
= ConfigurationSettings.AppSettings["SMTPAddress"].ToString();

            client.Send(message);
            AlertMessage(
"Sent mail sucess!");
            
return true;
        }

        
catch (Exception ex)
        
{
            
//msgTool.Add("SMTPERROR");
            AlertMessage("SMTPERROR");
            
return false;
        }

    }



SendMail([Supervisor Email], PO number, isHtml);

 

原文地址:https://www.cnblogs.com/ZhengGuoQing/p/1095445.html