Пример #1
0
        void SendEmailMessage(MailMessage email)
        {
            SmtpClient client = new SmtpClient(_config.SmtpServer);

            client.EnableSsl = _config.EnableSsl;
            client.Port      = _config.SmtpPort;

            if (!string.IsNullOrEmpty(_config.SmtpUsername))
            {
                client.Credentials = new System.Net.NetworkCredential(_config.SmtpUsername, _config.SmtpPassword);
            }

            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;

            _log.WriteLineDebug("Sending email to: {0}", email.To.ToString());

            client.Send(email);
        }