Saturday, June 8, 2013

Send email from localhost WAMP server using sendmail

Most of applications today are sending email to their subscribers or followers. During development stage, we need to test how this emails will look like. So, today we're going to configure our Wamp server to send an email. Here's the steps to achieve this:

  • Download the through this link
  • Now, extract the folder and put it to C:/wamp/. Make sure that these four files are present: sendmail.exe, libeay32.dll, ssleay32.ddl and sendmail.ini.
  • Open sendmail.ini and set the configuration as follows:
    • smtp_port=465
    • smtp_ssl=ssl
    • default_domain=localhost
    • error_logfile=error.log
    • debug_logfile=debug.log
    • auth_username=[your_gmail_account_username]
    • auth_password=[your_gmail_account_password]
    • pop3_server=
    • pop3_username=
    • pop3_password=
    • force_sender=
    • force_recipient=
    • hostname=localhost
  • Access your email account. Click the Gear Tool > Settings > Forwarding and POP/IMAP > IMAP access. Click "Enable IMAP", then save your changes.
  • Run your WAMP Server. Enable ssl_module under Apache Module.

  • Next, enable php_openssl and php_sockets under PHP.

  • Open php.ini (C:\wamp\bin\apache\Apache2.x.xx\bin) and configure it as the codes below. Basically, you just have to set the sendmail_path.
    [mail function]
    ; For Win32 only.
    ;SMTP =
    ;smtp_port = 25
    ; For Win32 only.
    ;sendmail_from =
    ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
    sendmail_path = "C:\wamp\sendmail\sendmail.exe -t -i"
  • Restart Wamp Server
  • The most exciting part, lets test it! Create a php file with the sample codes below and save it as mail_me.php:
  • Don't forget to change the $to and $headers to set the recipient/sender/reply back address.
  • Go to your browser and type localhost/mail_me.php; You should then receive an email

  • This may only work on wampserver 2.0 and higher.
  • In setting sendmail.ini, the error_logfile and debug_logfile settings should be kept blank unless you encounter an error. This is so the file will not keep in increasing in size.



  1. this still gives me an error ... Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

  2. Kasun

    i tried days to configure sendmail,finaly it worked perfectly,thanks a lot

    1. what kind of changes u made in sendmail. I did all changes mentioned in here but it didn't work out. Please help me out from the loop.