Exemple #1
0
        public bool Send(IEnumerable<Email> emails, BinaryAttachment[] binaryAttachments)
        {
            var client = new SmtpClient();
            var message = new MailMessage();
            foreach (var email in emails)
            {

                message.To.Add(email.To);
                message.Priority = email.Priority;
                //  message.Attachments = email.Attachments;
                message.From = new MailAddress("*****@*****.**");
                message.Subject = email.Subject;
                message.Body = email.Body;
                message.IsBodyHtml = email.IsBodyHtml;

                if (email.Enabled)
                {
                    client.Send(message);
                }

                message = new MailMessage();
            }

            client.Dispose();
            message.Dispose();

            return true;
        }
Exemple #2
0
        public bool Send(Email email, /*IDictionary<string, string> replacements = null,*/ BinaryAttachment[] binaryAttachments = null)
        {
            var client = new SmtpClient();
            var message = new MailMessage();

            message.To.Add(email.To);
            message.Priority = email.Priority;
              //  message.Attachments = email.Attachments;
            message.From = new MailAddress("*****@*****.**");
            message.Subject = email.Subject;
            message.Body = email.Body;
            message.IsBodyHtml = email.IsBodyHtml;

            if (email.Enabled)
            {
                client.Send(message);
            }

            client.Dispose();
            message.Dispose();

            return true;
        }