#region
sendmail
public
static bool SendMail(SPWeb web, string Subject, string Body, string To, string strFrom)
{
bool mailSent = false;
try
{
string smtpServer = SPAdministrationWebApplication.Local.OutboundMailServiceInstance.Server.Address;
MailMessage mailMessage = new MailMessage(strFrom, To, Subject, Body);
mailMessage.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient(smtpServer);
smtpClient.Send(mailMessage);
}
catch (Exception)
{
return mailSent;
}
return mailSent;
}
#endregion
sendmail
public
static bool SendMail(SPWeb web, string Subject, string Body, string To, string strFrom)
{
bool mailSent = false;
try
{
string smtpServer = SPAdministrationWebApplication.Local.OutboundMailServiceInstance.Server.Address;
MailMessage mailMessage = new MailMessage(strFrom, To, Subject, Body);
mailMessage.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient(smtpServer);
smtpClient.Send(mailMessage);
}
catch (Exception)
{
return mailSent;
}
return mailSent;
}
#endregion
No comments:
Post a Comment