I am using following code to send email. The Code works correctly in my local Machine. But on Production server i am getting the error message
var fromAddres
NOVEMBER 2018, have tried everything above with no success.
Below is the solution that worked finally. Unfortunately it's not using SSL, but it works!!!
var fromAddress = new MailAddress(asd@asd.com, "From Name");
var toAddress = new MailAddress("tosend@asd.com", "To Name");
const string subject = "Subject";
const string body = "Body";
var smtp = new SmtpClient
{
Host = "aspmx.l.google.com",
Port = 25,
EnableSsl = false
};
using (var message = new MailMessage(fromAddress, toAddress)
{
Subject = subject,
Body = body
})
{
smtp.Send(message);
}