Ejemplo n.º 1
0
        public void SendMail(MailSetting mailSetting, Mail mail)
        {
            try
            {
                if (mailSetting == null)
                {
                    throw new ArgumentNullException("mailSetting can not be null.");
                }

                var client = new SmtpClient(mailSetting.Host, mailSetting.Port);
                client.EnableSsl             = mailSetting.EnableSsl;
                client.UseDefaultCredentials = false;
                client.Credentials           = new NetworkCredential(mailSetting.UserName, mailSetting.Password);
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;

                client.Send(GetMailMessage(mailSetting, mail));
                mail.IsSent = true;
            }
            catch (Exception ex)
            {
                LogHelper.AddSystemErrorLog(ex.ToString());
            }
        }
Ejemplo n.º 2
0
 protected void Application_Error(object sender, EventArgs e)
 {
     LogHelper.AddSystemErrorLog(Server.GetLastError().ToString());
 }