1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
/// <summary>
/// Send()
/// </summary>
public bool Send()
{
bool flag = true;
//SLB - 29/09/08 - SmtpServer.Insert
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["EmailServer"];
//si le serveur est en maintenance
if (!canSend)
return false;
try
{
SmtpMail.Send(this);
}
catch
{
flag = false;
//Envoi d'un mail au tech
//MailGeneric(ConfigurationSettings.AppSettings["TechAdmin"],ConfigurationSettings.AppSettings["TechAdmin"],"Echec Envoi Mail",DateTime.Now + "<br>Sujet : " + this.Subject + "<br>Erreur : " + ex.Message);
}
finally
{
StreamWriter sw = new StreamWriter(ConfigurationSettings.AppSettings["Mail.log"],true);
sw.WriteLine(DateTime.Now + " " + this.Subject + " " + flag);
sw.Close();
this.Attachments.Clear();
this.Body = "";
this.Bcc = "";
this.Cc = "";
this.From = "";
this.Subject = "";
this.To = "";
}
return flag;
} |
Partager