Archive for January, 2009

Sending mail xampp gmail

Thursday, January 1st, 2009


If you’re developing on your local xampp environment, eventually you will need your apps to actually send mail:

Change the following lines in your php.ini
(usually here C:\xampp\php\php.ini, but possibly also php5.ini, and/or C:\xampp\apache\bin\php.ini):

smtp_port = 587
sendmail_from = [your_gmail_username]]
sendmail_path = “:\”C:\xampp\sendmail\sendmail.exe\” -t”

Change your sendmail.ini to read as follows (again, usually C:\xampp\sendmail\sendmail.ini):

account Gmail
tls on
tls_certcheck off
from [your_gmail_username]]
auth on
user [your_gmail_username]]
password [your_gmail_username]
port 587
account default : Gmail

Simple example test script to see that it worked:

$from_name = “yourName”;
$from_email = “”;
$headers = “From: $from_name <$from_email>”;
$body = “Hi, \nThis is a test mail from $from_name <$from_email>.”;
$subject = “Mail from my development environment”;
$to = “”;

if (mail($to, $subject, $body, $headers)) {
echo “success!”;
} else {
echo “fail…”;