I developed an ASP.net application that can send an email to any domain. I am using a simple .Net smtp client:
var fromAddress = new MailAddress("mymailid@gmail.com");
var fromPassword = "xxxxxx";
var toAddress = new MailAddress("yourmailid@yourdoamain.com");
var smtpClient = new System.Net.Mail.SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
};
smtpClient.Send(message). But I can not authenticate for any modern mail providers (including gmail, yahoo, yandex) using .Net.Mail, because I have the following exceptionThe server response was: 5.5.1 Authentication Required
All correctly populated smtp configuration.
How can I use DotNetOpenAuth for authentication and .Net.Smtp for sending emails? Please give me an example.
user5515846
source
share