How To: PHP Sendmail and XAMPP on Windows

It can be difficult getting the PHP’s default mail functions to work when you run an apache server on windows instead of a unix environment. I ran into this problem with my server (running XAMPP), and thought others may benefit from a quick how-to. Another slight problem I had to get working was using an SMTP server that requires SSL connections (gmail for one). I didn’t realize that most recent XAMPP releases have sendmail built in already. This takes part of the hassel out, but we still have some configuring to do.
First, ensure that you have an XAMPP release that does include the fake sendmail program.
Next, go to the XAMPP directory (often C:\xampp\), then open the ’sendmail’ subdirectory. You’ll most likely see the following files (default):
Open the file sendmail.ini – this is where all of your SMTP server configurations will go, for example: SMTP Username, Password, Host, Port, etc
My sendmail.ini file looks something like this:
; configuration for fake sendmail
; SMTPS (SSL) support
; auto = use SSL for port 465, otherwise try to use TLS
; ssl = alway use SSL
; tls = always use TLS
; none = never try to use SSL
; if your smtp server requires authentication, modify the following two lines
auth_password=<PASSWORD HERE>
Note that this is a very simple setup. The variable names are fairly obvious, so simply fill in the SMTP server, port, ssl mode, username, password, and default domain / error log if you’d like.
GMail requires an SSL connection, so my config was setup to use SSL port 465 and smtp_ssl=auto. If SSL is not necessary for your SMTP server, simply set smtp_ssl=none.
Once the configuration is setup, make sure to save changes, then exit.
If you are going to use SSL connections, you will need two additional files, available here ”” (as of Feb 2008) – if this link no longer works, use the contact form and let me know. or try
Extract the two compressed files (libeay32.dll and ssleay32.dll) to the same directory as sendmail.exe (for me, C:\xampp\sendmail\)
Now, everything on the sendmail’s end is setup – now we just need to let the server know its there!
Edit your PHP.ini file:
XAMPP installations often have multiple files. If you are doubtful of the correct one, you can always go through and change them all. But before you do that, change the php.ini in \xampp\apache\bin\.
Look for the following line:

sendmail_path = “C:\xampp\sendmail\sendmail.exe -t”
Uncomment the line (if already commented) by removing the semicolon at the start.
Ensure that the path to sendmail.exe is correct (this is correct for me).
Save and exit php.ini
Restart the apache server and everything should work!
Comment if you have a question.

Categorised as: Microsoft, Networking


  1. ngulPi says:

    need sendmail.ini are different and i’m using xampp 1.7.4

    this is my sendmail.ini look like

    ; configuration for fake sendmail

    ; if this file doesn’t exist, sendmail.exe will look for the settings in
    ; the registry, under HKLM\Software\Sendmail


    ; you must change to your smtp server,
    ; or to IIS’s “pickup” directory. (generally C:\Inetpub\mailroot\Pickup)
    ; emails delivered via IIS’s pickup directory cause sendmail to
    ; run quicker, but you won’t get error messages back to the calling
    ; application.


    ; smtp port (normally 25)


    ; the default domain for this server will be read from the registry
    ; this will be appended to email addresses when one isn’t provided
    ; if you want to override the value in the registry, uncomment and modify


    ; log smtp errors to error.log (defaults to same directory as sendmail.exe)
    ; uncomment to enable logging


    ; create debug log as debug.log (defaults to same directory as sendmail.exe)
    ; uncomment to enable debugging


    ; if your smtp server requires authentication, modify the following two lines


    ; if your smtp server uses pop3 before smtp authentication, modify the
    ; following three lines


    ; to force the sender to always be the following email address, uncomment and
    ; populate with a valid email address. this will only affect the “MAIL FROM”
    ; command, it won’t modify the “From: ” header of the message content


    ; sendmail will use your hostname and your default_domain in the ehlo/helo
    ; smtp greeting. you can manually set the ehlo/helo name if required


    i don’t know how to fix it..pls i really need to urgent response..thanks..

  2. ngulPi says:

    should i copy you’re sendmail.ini file?

  3. betty says:

    thank you a million for your post, I’m currently setting up sendmail on a windows server using SSL, I followed the link you provided ( but it’s no loger reachable, where else could I find them?
    Thank you a million

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.