Send test emails with WampServer

What you’ll need:

  • WampServer downloaded and installed (I am using version 1.7.3)
  • Fake Sendmail
  • GoDaddy email account (I tried Gmail and Yahoo email accounts but couldn’t get them working.)

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:\wamp\sendmail”.

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:\wamp\sendmail”.

  • line 14 | smtp_server=smtpout.secureserver.net
  • line 18 | smtp_port=80
  • line 38 | auth_username=youremail@goeshere.com
  • line 39 | auth_password=yourpasswordgoeshere

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:\wamp\sendmail\sendmail.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).

47 thoughts on “Send test emails with WampServer”

  1. 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.

  2. 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

  3. 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.

  4. 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?

  5. 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.

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

  7. 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

  8. 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 .

  9. 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

  10. 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…

  11. 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…

  12. 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.

  13. 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!

  14. 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.

  15. 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!

  16. 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.

  17. 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

  18. //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”;
    }

  19. 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.

  20. 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?

  21. Great tutorial. I did fall over on the naming conventions but I got there in the end. I had to change my port to 25 before it worked 🙂

    1. @Martin

      I am glad you were able to get it working. I use GoDaddy email to send the emails and they allow ports 25, 80, 3535. I went with port 80 because I figured my ISP was blocking port 25.

  22. Thanks for this – it actually helped me a lot and saved at least few hours (damn Magento email templates). As a matter of fact I managed to run it with Google Apps just by extracting 2 dlls from sendmail-SSL.zip (available at the location you provided) and setting up:
    smtp_server=smtp.gmail.com
    smtp_port=587
    smtp_ssl=tls
    default_domain=mydomain.com
    auth_username=mail@mydomain.com
    auth_password=mypass

  23. Guys had issues aswell with Magento, WAMP and Sendmail, dont copy and paste the string. Type it in manually, the quotes are not actually quotes. Thanks for the tip Ed, your solution fixed me

  24. Works well for me, using the SMTP server provided by my hosting company.

    The current version has a “force_recipient=” option in the .ini file which I have set to a test/junk email address I use. This means that when I’m testing a mailing list application (the reason I installed it) with a list of live addresses the mails will actually come to me.

  25. Hello to all,
    I got same problem – forcin WAMP to send email and I tried with this instructions, with goddady account, but I failed. Maybe I did something wrong. But most important thing is that I tried with gmail smtp server and I succeeded! So this really works!
    And (at least in firefox), I see sendmail path as:
    c:wampsendmail
    And it should be: c:\wamp\sendmail…
    Maybe this text won’t be displayed well to, because backslash is used for escaping chars, but look at second photo with red text underline!!
    Thanks Josh!

  26. Excellent tutorial AND replies.
    Now I finally got my wamp setup working with smpt.gmail.com as mail server.
    .. now back to my php beginner tutorials .. I love programming WHEN the technique works!
    Thanks again
    Mads

  27. Finally, after a day of searching, a clear explanation of what to do. I wish everybody could explain things as well as you. I had to trawl through pages and pages of Google rubbish of people who either didn’t have a clue or if they did didn’t explain themselves properly, some assuming what might be obvious for them but not to everybody, before I came here. It worked for me. Thanks, Josh.

  28. Works great. Didn’t work the first time just because i left the quotation marks for the command line “c:\wamp\sendmail\sendmail.exe –t.” Great tutorial. Thanks a lot!

Leave a Reply to johnyrot Cancel reply

Your email address will not be published. Required fields are marked *