Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Encrypting password for email
#23
To try Sendmail C# code:

CsFunc("" "PasswithoutEncrypt" "[email protected]" "Test Sendmail C# 05-09-2016" "Body Text")


#ret
//C# code
using System;
using System.Net;
using System.Net.Mail;

public class Email
{
static public void Send(string password, string email, string subject, string body)
{
var fromAddress = new MailAddress("[email protected]", "Email Account Name");
var toAddress = new MailAddress(email);

var smtp = new SmtpClient
{
Host = "smtp.mail.yahoo.com",
Port = 465,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress.Address, password)
};
using (var message = new MailMessage(fromAddress, toAddress)
{
Subject = subject,
Body = body
})
{
smtp.Send(message);
}
}
}

---------
ERROR:

Error (RT) in <open ":3047: /0">Sendmail C code: 0x80131500,
Error al enviar correo.
en System.Net.Mail.SmtpClient.Send(MailMessage message)
en Email.Send(String password, String email, String subject, String body).


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)