Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required

When you try to send mail from code and you find the error “The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required”, than the error might occur due to following cases. case 1: when the password is wrong case 2: when you try to … Read more

Send email using the GMail SMTP server from a PHP page

// Pear Mail Library require_once “Mail.php”; $from = ‘<[email protected]>’; $to = ‘<[email protected]>’; $subject=”Hi!”; $body = “Hi,\n\nHow are you?”; $headers = array( ‘From’ => $from, ‘To’ => $to, ‘Subject’ => $subject ); $smtp = Mail::factory(‘smtp’, array( ‘host’ => ‘ssl://smtp.gmail.com’, ‘port’ => ‘465’, ‘auth’ => true, ‘username’ => ‘[email protected]’, ‘password’ => ‘passwordxxx’ )); $mail = $smtp->send($to, $headers, … Read more

Sending email in .NET through Gmail

Be sure to use System.Net.Mail, not the deprecated System.Web.Mail. Doing SSL with System.Web.Mail is a gross mess of hacky extensions. using System.Net; using System.Net.Mail; var fromAddress = new MailAddress(“[email protected]”, “From Name”); var toAddress = new MailAddress(“[email protected]”, “To Name”); const string fromPassword = “fromPassword”; const string subject = “Subject”; const string body = “Body”; var smtp … Read more

Smtp authentification required [duplicate]

You need to tell the SMTP client that you will not be using your windows credentials to access the SMTP, so add smtpClient.UseDefaultCredentials = false; above this line of code smtpClient.Credentials = new NetworkCredential(“[email protected]”, “password”); Also, gmail doesn’t allow impersonation, so mailMessage.From = new MailAddress(“[email protected]”); will have no effect – the emails will still appear … Read more