Exemplo n.º 1
0
        public void SendMail(string mailFrom, string mailToSupport, string subject, string body)
        {
            try
            {
                EventLog.saveMessage("Sending mail to:" + mailToSupport);

                MailMessage messageForSupport = new MailMessage(mailFrom, mailToSupport, subject, body);
                SmtpClient  clientSupport     = new SmtpClient(MainFunctions.GetValueFromWebConfig("MailServer"));
                clientSupport.UseDefaultCredentials = true;
                clientSupport.Credentials           = new System.Net.NetworkCredential(mailFrom, MainFunctions.GetValueFromWebConfig("MailFromPassword"));
                clientSupport.Send(messageForSupport);

                EventLog.saveMessage("Mail is sent to :" + mailToSupport);
            }
            catch (Exception exx)
            {
                EventLog.saveMassage("Грешка при изпращане на e-mail на: '" + mailToSupport + "'", exx);
            }
        }