Send email using the GMail SMTP server from a PHP page -


i trying send email via gmail's smtp server php page, error:

authentication failure [smtp: smtp server no support authentication (code: 250, response: mx.google.com @ service, [98.117.99.235] size 35651584 8bitmime starttls enhancedstatuscodes pipelining)]

can help? here code:

<?php require_once "mail.php";  $from = "sandra sender <sender@example.com>"; $to = "ramona recipient <ramona@microsoft.com>"; $subject = "hi!"; $body = "hi,\n\nhow you?";  $host = "smtp.gmail.com"; $port = "587"; $username = "testtest@gmail.com"; $password = "testtest";  $headers = array ('from' => $from,   'to' => $to,   'subject' => $subject); $smtp = mail::factory('smtp',   array ('host' => $host,     'port' => $port,     'auth' => true,     'username' => $username,     'password' => $password));  $mail = $smtp->send($to, $headers, $body);  if (pear::iserror($mail)) {   echo("<p>" . $mail->getmessage() . "</p>");  } else {   echo("<p>message sent!</p>");  } ?> 

// pear mail library require_once "mail.php";  $from = '<fromaddress@gmail.com>'; $to = '<toaddress@yahoo.com>'; $subject = 'hi!'; $body = "hi,\n\nhow you?";  $headers = array(     'from' => $from,     'to' => $to,     'subject' => $subject );  $smtp = mail::factory('smtp', array(         'host' => 'ssl://smtp.gmail.com',         'port' => '465',         'auth' => true,         'username' => 'johndoe@gmail.com',         'password' => 'passwordxxx'     ));  $mail = $smtp->send($to, $headers, $body);  if (pear::iserror($mail)) {     echo('<p>' . $mail->getmessage() . '</p>'); } else {     echo('<p>message sent!</p>'); } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -