include('/usr/share/php/Mail.php');
echo "mail inlcuded";
$recipients = 'testemail@gmail.com';
$headers['From'] = 'google@gmail.com';
$headers['To'] = 'testemail@gmail.com';
$headers['Subject'] = 'Test message';
$body = 'Test message';
//$params['sendmail_path'] = '/usr/lib/sendmail';
//$params['sendmail_path'] = '/usr/share/php/Mail';
$params['auth'] = true;
$params['host'] = 'ssl://<google mail server name>';
$params['port'] = '<port no like 456>';
$params['username'] = 'testemail@gmail.com';
$params['password'] = "xxxxxxxxx";
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('smtp', $params);
echo "<br>Object created";
$mail = $mail_object->send($recipients, $headers, $body);
//exit;
echo "<br>Sending mail";
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
echo "mail inlcuded";
$recipients = 'testemail@gmail.com';
$headers['From'] = 'google@gmail.com';
$headers['To'] = 'testemail@gmail.com';
$headers['Subject'] = 'Test message';
$body = 'Test message';
//$params['sendmail_path'] = '/usr/lib/sendmail';
//$params['sendmail_path'] = '/usr/share/php/Mail';
$params['auth'] = true;
$params['host'] = 'ssl://<google mail server name>';
$params['port'] = '<port no like 456>';
$params['username'] = 'testemail@gmail.com';
$params['password'] = "xxxxxxxxx";
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('smtp', $params);
echo "<br>Object created";
$mail = $mail_object->send($recipients, $headers, $body);
//exit;
echo "<br>Sending mail";
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
No comments:
Post a Comment