{
string strERRORMSG = "";
try
{
//create the mail message
MailMessage Mailstr = new MailMessage();
//set the addresses
Mailstr.From = new MailAddress(strMailFrom);
Mailstr.To.Add(strMailTo);
if (strMailCc != "")
Mailstr.CC.Add(strMailCc);
// set the content
Mailstr.Subject = strMailSubject;
Mailstr.Body = strMailBody + "<br><br><br>";
Mailstr.IsBodyHtml = true;
if (strRPTPATH != "")
{
string file = @strRPTPATH;
Attachment data = new Attachment(file);
Mailstr.Attachments.Add(data);
}
//Send the message.
SmtpClient client = new SmtpClient(strMailServer);
client.Send(Mailstr);
}
catch (System.Exception Ex)
{
strERRORMSG = "ERROR MESSAGE:" + Ex.ToString();
SendMail(mailserver, "JOB失敗", ADMIN_EMAIL, ADMIN_EMAIL, "", "更新 ERROR MESSAGE:" + Ex.ToString(), "");
}
}
沒有留言:
張貼留言