62,046
社区成员
发帖
与我相关
我的任务
分享
public bool SendEmail(string strAddresser, string strRecipients, string strDetail, string strTitle, string strServer,string strPWD)
{
MailMessage myMailMessage = new MailMessage();
myMailMessage.BodyFormat = MailFormat.Html;
myMailMessage.From = strAddresser; // 发件人
myMailMessage.To = strRecipients; // 收件人
myMailMessage.Body = strDetail; // 内容
myMailMessage.Subject = strTitle; // 标题
SmtpMail.SmtpServer = strServer; // 邮件服务器地址,如 "mail.qs-soft.com"
myMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1);
myMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",strAddresser); //发送方邮件帐户
myMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", strPWD); //发送方邮件密码
try
{
SmtpMail.Send(myMailMessage);
return true;
}
catch
{
return false;
}
}