Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.