I am using pear lib for sending an email and getting three issues when I am sending any emails from Gmail using PHP.
1) I am getting HTML code in the email.
2) If I am using any anchor element then email delivery failed.// without anchor element it is working.
3) The anchor element link is not working in iPhone.// for iPhone i tried
require_once "mail/Mail.php";
$to = $email;
$from = 'user@gmail.com';
$subject = 'Test!';
$body = "<html><head><title>HTML email</title></head>
<body>
<a href='domain.com/changepassword.php?user_id=" .$User_id1."'>Create your password here</a>
</body>
</html>";// HTML code is display in email
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => 'ssl://smtp.gmail.com',
'port' => '465',
'auth' => true,
'username' => 'user@gmail.com',
'password' => '******'
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo('<p>' . $mail->getMessage() . '</p>');
} else {
echo('<p>Message successfully sent!</p>');
}