Send test emails with WampServer

What you’ll need:

SendmailGo ahead and install WampServer. I just installed mine to the root of the c: drive so it makes for easy access (For example, “c:wamp”).

Next download Fake Sendmail. Fake Sendmail, aka sendmail.exe, is a simple windows console application that emulates sendmail’s “-t” option to deliver emails. Extract the sendmail.zip file and move the folder here: “c:wampsendmail”.

We need the GoDaddy email account because sendmail.exe requires an smtp server to perform the actual delivery of the messages. Now let’s configure some settings in the sendmail.ini file located here: “c:wampsendmail”.

There are a few lines that need to be commented out/uncommented so I am providing a text version of the sendmail.ini file: sendmail.txt. Once your file looks similar to mine, save and close the sendmail.ini file.

Only one step left and that’s to make a change in the php.ini. Access the php.ini using this method below.

Sendmail Illustration 1

Search for sendmail_path and set it to “c:wampsendmailsendmail.exe –t”.

Sendmail Illustration 2

Save and close the php.ini file.

You must restart WampServer for the changes to the php.ini to take effect.

Having the ability to send test emails is great especially if you frequently work on scripts that require email generation. At least I think so (I’m smiling).

Comments

25 Responses to “Send test emails with WampServer”

  1. Jacob Santos » Blog Archive » How to send email on Windows with WAMP on January 24th, 2008 9:30 pm

    [...] Josh Stauffer wrote a tutorial on how to setup WAMP to send email on Windows. This is something that has plague my debugging ability with sending email for a long time. It is something that I’ll be using quite frequently until it becomes ingrained in my head. [...]

  2. Jacob Santos on January 25th, 2008 5:20 pm

    One thing to note is to make sure you write out the fill path to the sendmail.exe. I made the mistake of just copying the path and it blew up on me.

  3. Josh Stauffer on January 25th, 2008 10:10 pm

    Jacob, Glad you were able to get it working.

  4. Jacob Santos » Blog Archive » First WordPress Plugin: Alternative Mailer on January 26th, 2008 9:59 pm

    [...] spent spent some time working on the plugin and was able to test it locally using the tutorial Josh Stauffer wrote. It replaces the ShiftThis SMTP plugin and adds more methods. I have nothing against ShiftThis [...]

  5. Pat O'Meara on March 11th, 2008 12:51 am

    Hey Josh, nice tute, just what I am looking for, do you know if this works with phpmailer, I can’t seem to get it working, but not getting any errors.

    Cheers,
    Pat

  6. Josh Stauffer on March 11th, 2008 6:39 pm

    Pat, I am not sure if this will work with PHPMailer however, the method I outlined is the simplest I have found.

    Try checking the error.log or debug.log inside the sendmail directory for any clues as to why the emails aren’t being sent.

  7. khadijah on March 13th, 2008 7:01 pm

    hi josh
    i’m new to this…
    i’ve already try your tute but i got this 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() in C:\wamp\www\cth\mailsend.php on line 11

    could you please help me?

  8. Josh Stauffer on March 13th, 2008 7:41 pm

    Khadijah, looks like either you have forgotten to configure your php.ini file or you need to restart WampServer. Read the tute one more time to make sure that you have completed all of the steps. If you need more assistance please let me know.

  9. khadijah on March 13th, 2008 8:01 pm

    i need more assistance….i’ve completed all of the steps and already restart wampserver but still got that error..

  10. dilruk on May 6th, 2008 2:57 am

    Warning: mail() [function.mail]: “sendmail_from” not set in php.ini or custom “From:” header missing in f:\program files\wamp\www\contact us.php on line 201

    this error comes i tried so many times

  11. Gaurav on May 22nd, 2008 5:52 am

    i got the same error, but i found where is the error, generally in php.ini where you setting the path is commented. make sure it is not commented .

  12. neo on June 16th, 2008 6:56 pm

    hey is the GoDaddy create account free or not? im having a second thought of not creating one because of its future fees… T_T

  13. neo on June 16th, 2008 7:16 pm

    ive got an error too T_T how can i try emailing myself if ive got this kind of error…

    im new to php, graduate student of Philippines P.U.P. i hope newbies like me are welcome in here

    got an error of:

    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() in C:\wamp\www\socialized\services.php on line 83

    Please help me…

  14. neo on June 17th, 2008 5:05 am

    i hope a newbie like me is welcome in here…
    im a fresh graduate from Philippines and having trouble building a website hehehe just learning PHP along the way…

    but now ive encountered a problem of mailing system…

    Warning: mail() [function.mail]: “sendmail_from” not set in php.ini or custom “From:” header missing in c:\wamp\www\services.php on line 83

    ive followed all the instructions yet ive got an error…

  15. eddie on July 6th, 2008 6:16 am

    ive been trying to install mail on my wamp for some time now, i came across your tutorial, and it seemed to be spelled out pretty well, im using wamp 2.0. ive made the changes to the php.ini file, ive installed the sendmail into the wamp root, ive configured the wamp to port 80, im using godaddy smtp mail, i have my username@goeshere.com and password according, ive uncommented all the lines identical, i’m not getting any errors, but, i’m not receiving any mail when i fill out my forms, i know the php forms are proper, they work on my “hosting acct” just not sending any mail from my “local host”

    at the bottom of the sendmail.ini theres a field that is uncommented on both of ours. (hostname= ) should that be commented? or filled in? or left blank?

    any help would be appreciated.

    i changed my aol port and my skype port to resolve conflicts, i have router forwarding turned on, i have ports open on my firewall for forwarding, my wamp is in great shape, i just wish it would send my emails somewhere that i could check.

  16. ed on July 6th, 2008 7:50 am

    WooHoo

    i guess i made the FATAL mistake of copying and pasting the “c:\wamp\sendmail\sendmail.exe -t” line, as is..

    the quotation makes weren’t correct by doing this i believe.

    (i)should of been in bed 5 hrs ago :sigh:

    thanks for telling me how its done, mostly. and i also went into the “bin” folder, and changed all 3 php.ini files to match the php.ini file that you get when you click on the icon.. i noticed that when you change the php.ini file by clicking the icon, it doesn’t change any of the 3 php.ini files inside of the “wamp\bin\php” folder directory. i changed these before i figured out what my problem was, and i wanted them to all point to the same sendmail_path. do you think it was unneccasary or give me any problems?

    worst case scenario, i can always reinstall wamp and fakemail, and readjust the settings, seeing as how it should only take me 20mins next time instead of 2 sleepless nights. sad? me? i know.

    Thanks again!

  17. bluHatter on July 9th, 2008 6:49 am

    RE: PHPMailer

    I got this working with PHPMailer without any problems whatsoever. Make sure and check your C:\wamp\sendmail\error.log file to see what the problems really are.

    Great article, Josh. Functional and to the point.

  18. Install, Upgrade, Test and Debug your CMS website locally on a Windows machine | Fili's tech on July 18th, 2008 7:40 am

    [...] Configure your installation to send emails using fake sendmail for Windows. [...]

  19. Trev on August 2nd, 2008 7:54 am

    I have been looking into this for quite sometime and and I came accross the Best Mail Server 3.04. It took me a few seconds to set up a local email server. As I test the php mail function instantly I have the mail in my outlook express. Its awesome! Try it it will save you hassle. You dont need to cong any php.ini. I just install WAMPSERVER2 and Best Mail Server 3.04 no problems!

  20. Kozan Huseyin on August 4th, 2008 9:12 pm

    I kept the port settings at 25 and it still works, so thought I add that. Glad you have given us this worthy post.

    Worked like a charm :>

    Thanks a lot.

  21. Ashoka on November 10th, 2008 2:04 am

    i am trying many time to send mail but i cant send mail any body please help me

    my index.php file is

    my php.ini file is

    [mail function]
    SMTP = smtp.wlink.com.np
    smtp_port = 25

  22. Ashoka on November 10th, 2008 2:06 am

    //index.php

    $headers = ‘MIME-Version: 1.0′ . “\r\n”;
    $headers .= ‘Content-type: text/html; charset=iso-8859-1′ . “\r\n”;
    $headers .= ‘From: sender@sender.com’ . “\r\n”;
    $to = “man.of.think@gmail.com”;
    $subject = “My first mail”;
    $message = “I Gottt”;
    if(mail(”man.of.think@gmail.com”,”test subject”,”test body”,$headers))
    {
    echo “Mail sent”;

    }
    else
    {
    echo “Error on sending”;
    }

  23. Install, upgrade, test and debug your CMS website locally on a Windows machine | Tech Snacks on May 20th, 2009 6:14 pm

    [...] Configure your installation to send emails using fake sendmail for Windows. [...]

  24. ted on June 2nd, 2009 7:20 pm

    great info.. thanks.

    i think gmail as the smtp wont work because it needs ssl, yes?
    using your own isp’s smtp should work as well.

  25. BTP on June 18th, 2009 2:58 pm

    Would this work if I setup an email marketing tool like http://www.openemm.org/ I am going to run it on a web server but i would like to test it on multiple email address’s in the office. I don’t think it would be ideal to actually run this on my local server correct?

Leave a Reply