Jump to content

PEAR mail with gmail smtp


ttocskcaj

Recommended Posts

Hi I'm trying to get my script to send emails using the PEAR mail function but I keep getting and error code.

include('Mail.php');
           
$from = "My email";
$subject = "Heoli Verification";
$body = "Hi,\nClick this link to activate your account\n".$validate_link;

$host = "ssl://smtp.gmail.com";
$port = '465';
$username = "my email";
$password = "my password";

$headers = array (
'From' => $from,
'To' => $email,
'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)) 
{
      die("<p>" . $mail->getMessage() . "</p>");
}
      else

Rest of code...

Error message:

Failed to add recipient: @localhost [sMTP: Invalid response code received from server (code: 555, response: 5.5.2 Syntax error. v13sm4079748wfv.17)]

 

php 5.3.1 with XAMPP

Link to comment
https://forums.phpfreaks.com/topic/211337-pear-mail-with-gmail-smtp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.