Example #1
0
        public Task SendSmtpEmailAsync(ServerSettings serverSettings, MyMeetupEmail email)
        {
            SmtpClient  smtpClient = GetSmtpClient(serverSettings);
            MailMessage message    = CreateEmailMessage(email);

            return(smtpClient.SendMailAsync(message));
        }
Example #2
0
        public void SendSmtpEmail(ServerSettings serverSettings, MyMeetupEmail email)
        {
            SmtpClient  smtpClient = GetSmtpClient(serverSettings);
            MailMessage message    = CreateEmailMessage(email);

            smtpClient.Send(message);
        }
Example #3
0
        private MailMessage CreateEmailMessage(MyMeetupEmail email)
        {
            MailMessage message = new MailMessage(email.From, email.To, email.Subject, email.Body);

            message.IsBodyHtml = true;
            if (!string.IsNullOrEmpty(email.ReplyTo))
            {
                message.ReplyToList.Add(email.ReplyTo);
            }
            if (!string.IsNullOrEmpty(email.CC))
            {
                message.CC.Add(email.CC);
            }
            if (!string.IsNullOrEmpty(email.BCC))
            {
                message.CC.Add(email.BCC);
            }
            return(message);
        }