• Archives

  • Categories

May 15

How to use sendmail in XAMPP for Windows using AOL Mail

The easiest way to start developing in PHP is to get XAMPP, the whole package can even be placed in a flash drive. Using the free AOL Mail account also allows you to sign in to the SMTP server without TLS which allows XAMPP sendmail to work.

0. Objective

To get your PHP scripts to send an email out. This guide assumes you have XAMPP or XAMPP Lite. My environment is Windows Vista. (I use XAMPP Lite by the way.)

My XAMPP is placed in C:\xampplite\, so your configuration may be a little different. The files to be modified are sendmail.ini and php.ini.

1. Finding a mail host that allows non-secured connection

Previously I wrote a guide on How to use sendmail in XAMPP for Windows but some people have difficulties successfully sending out an email with their web hosts. There is nothing particularly wrong with the guide. It is because XAMPP’s sendmail is compiled without TLS options. TLS (Transport Layer Security) is the successor of SSL that is required by some mail servers for authentication. Hotmail, which just launched POP3, requires you to use TLS for example. If you are thinking of Gmail, you’re out of luck too.

AOL Mail allows non-secure authentication which means we don’t need to recompile sendmail. This guide therefore uses AOL Mail. Sign up for a free AOL Mail account.

2. Modify your sendmail.ini

Your sendmail.ini should be located in C:\xampplite\sendmail\sendmail.ini. You only need to be concern with 4 variables here:

  1. smtp_server
  2. smtp_port
  3. auth_username
  4. auth_password

Get them filled in, feel in your own username and password. Username is your AOL Mail email account, an example would be ‘justrealized_kahwee@aol.com’. That is not my email by the way. Remember the SMTP port is 587.

smtp_server=smtp.aol.com
smtp_port=587
auth_username=justrealized_kahwee@aol.com
auth_password=dp2hsn12

3. Modify your php.ini

XAMPP places the php.ini inside C:\xampplite\apache\bin\php.ini. You can open the file and do a search for ‘sendmail_path’. It’s at line 704 for me. You can simply uncomment that line.

sendmail_path = “C:\xampplite\sendmail\sendmail.exe -t”

And that’s all. Now for some testing. AOL mail requires you to use your AOL Mail email as the from_email, so I’ll be using ‘justrealized_kahwee@aol.com’.

3. Let’s test it out

<?php
$from_name = "Justrealized";
$from_email = "justrealized_kahwee@aol.com";
$headers = "From: $from_name <$from_email>";
$body = "Hi, \nThis is a test mail from $from_name <$from_email>.";
$subject = "Test mail from Justrealized";
$to = "somewhere@justrealized.com";

if (mail($to, $subject, $body, $headers)) {
  echo "success!";
} else {
  echo "fail…";
}
?>

Execute those codes and you should receive something in your inbox. Here’s what I see in Gmail:

And you get this in Gmail

Hope it works for you. Please correct me if I missed out anything.

(Those aren’t my email, if you sent emails there your emails will get sucked into some blackhole.)

Possibly related:

  1. How to use sendmail in XAMPP for Windows
  2. Just gotten XAMPP 1.7.1
  3. How to enable cURL in PHP for Windows
  4. Some problems with XAMPP 1.7.0 and Windows 7

“How to use sendmail in XAMPP for Windows using AOL Mail”
10 comments

  1. tony

    THANX!!! I already had it set to aol but it didn’t work! All I had to do was change the port number! WOW! THANK YOU!

    May 16

  2. Tony: You’re most welcome. :)

    May 16

  3. Good news for anyone wanting to use gmail…Check out: http://brettshaffer.com/how-to/php-sendmail-and-xampp-on-windows/

    KahWee, I just tested it with your script, and…. it works!

    May 17

  4. Ahni: Thanks for sharing. Gmail requires more security for its SMTP so I was trying to avoid that. Your method is great alternative though. Will use it if one day SSL becomes a requirement. :)

    May 17

  5. [...] Gmail users may check Brett Shaffer’s solution, alternatively, AOL users may see KahWee’s solution. [...]

    Jul 08

  6. bored

    sorry does’nt work at all..nice try

    Aug 18

  7. [...] can struggle to send mails in your php script. There is a wider information about the issue in this article. All i do is change the d:xamppsendmailsendmail.ini file as below [sendmail] [...]

    Aug 25

  8. Josh

    I’m having a problem with your instructions, thanks for them by the way. I’m getting it to say success, but I’m not receiving the emails being sent and in the apache error.log I’m getting the error “sendmail.exe: F:\xampp\sendmail\sendmail.ini: line 1: unknown command smtp_server=smtp.aol.com”

    Sep 18

  9. susie

    nice. but doesnt work for me. receive no email after i sent it. dont know where to correct it

    Sep 18

  10. Neotorpic

    Eh, ok. So I tried everything every single one of these sites say. Do this, do that, change this change that. And yet… mail sent success! Ok… wait, wait… nothing! Who ever made this app, fail. Sorry, besides this issue, it has many other issues. Apache2Traid Was nice, no jumping through hoops to set up something so simple. Unfortunately, no longer updated. 3 different SMTP host’s I tried. My own domain, Cox.net and gmail.

    Tried:
    “sendmail -t -i” – Mail sent Success – But truly… not.
    “C:\web\xampp\sendmail\sendmail.exe -t” exact same thing.

    Even tried setting the SMTP in the php.ini. Done this numerous times. But why is it not working with this application?

    Yes… I restarted Apache as well. No matter what I do or what I change this simply does NOT work. And i thank you developer (i know not here) Just make development more painstakingly painful. Any time of mailing, sendmail I know have to upload to test.

    Nov 21

Leave your comment.


WordPress powered and Django inspired.
Love and elephants come after.
RSS: Posts and comments.