Strict Standards: Declaration of RSS::DoAction() should be compatible with CMSModule::DoAction($name, $id, $params, $returnid = '') in /home/xandaorg/public_html/modules/RSS/RSS.module.php on line 114

Strict Standards: Non-static method PageInfoOperations::LoadPageInfoByContentAlias() should not be called statically in /home/xandaorg/public_html/index.php on line 149

Warning: Cannot modify header information - headers already sent by (output started at /home/xandaorg/public_html/modules/RSS/RSS.module.php:114) in /home/xandaorg/public_html/index.php on line 294
Xanda - /dev/project - Use GMail SMTP to send mail in PHP

Maybe some of use might face difficulty to use mail() in PHP espesially when the server is behind firewall or the is no SMTP application running on the server.

In this case, you might need an external SMTP server to push the email. Here i would like to suggest you guys to use phpmailer class.

Here is the example to use it. But first, you need to download phpmailer class first and create the following file in the same directory with phpmailer

$mail = new PHPMailer();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // use ssl
$mail->Host = ""; // GMAIL's SMTP server
$mail->Port = 465; // SMTP port used by GMAIL server
$mail->Username = ""; // GMAIL username
$mail->Password = "password"; // GMAIL password
$mail->AddReplyTo("","FirstName LastName"); // Reply email address
$mail->From = "";
$mail->FromName = "FirstName LastName"; // Name to appear once the email is sent
$mail->Subject = "Subject of the email"; // Email's subject
//$mail->Body = "Hello World,<br />This is the HTML BODY<br />"; //HTML Body
$mail->AltBody = "This is a test email"; // optional, comment out and test
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($body); // [optional] Send body email as HTML
$mail->AddAddress("", "First Last"); // email address of recipient
//$mail->AddAttachment("files/"); // [optional] attachment
$mail->IsHTML(true); // [optional] send as HTML
echo "Mailer Error: " . $mail->ErrorInfo;
echo "Message sent!";

Enjoy! ;)