Ejemplo n.º 1
0
        public static void sendEmail(MessageEmail message, string host, int port, bool enablessl, string email, string password)
        {
            MailMessage mail       = new MailMessage();
            SmtpClient  SmtpServer = new SmtpClient(host);

            mail.From = new MailAddress(email);
            mail.To.Add(message.Destination);
            mail.Subject = message.Subject;
            mail.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(message.Body, null, MediaTypeNames.Text.Html));

            SmtpServer.Port        = port;
            SmtpServer.Credentials = new System.Net.NetworkCredential(email, password);
            SmtpServer.EnableSsl   = enablessl;
            SmtpServer.Send(mail);
        }
Ejemplo n.º 2
0
        public static void sendEmail(MessageEmail message)
        {
            MailMessage mail       = new MailMessage();
            SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");

            mail.From = new MailAddress("*****@*****.**");
            mail.To.Add(message.Destination);
            mail.Subject = message.Subject;
            mail.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(message.Body, null, MediaTypeNames.Text.Html));

            SmtpServer.Port        = 465;
            SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "fgzdjbkflqskcvyp");
            SmtpServer.EnableSsl   = true;
            SmtpServer.Send(mail);
        }