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

JoshStauffer.com runs on the Genesis Framework

Genesis Framework

Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!

Take advantage of the 6 default layout options, comprehensive SEO settings, rock-solid security, flexible theme options, cool custom widgets, custom design hooks, and a huge selection of child themes ("skins") that make your site look the way you want it to. With automatic theme updates and world-class support included, Genesis is the smart choice for your WordPress website or blog.

Become a StudioPress affiliate

Comments

  1. Jacob Santos says:

    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. Josh Stauffer says:

    Jacob, Glad you were able to get it working.

  3. Pat O'Meara says:

    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

  4. Josh Stauffer says:

    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.

  5. khadijah says:

    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?

  6. Josh Stauffer says:

    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.

  7. khadijah says:

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

  8. dilruk says:

    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

  9. Gaurav says:

    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 .

  10. neo says:

    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

  11. neo says:

    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…

  12. neo says:

    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…

  13. eddie says:

    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.

  14. ed says:

    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!

  15. bluHatter says:

    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.

  16. Trev says:

    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!

  17. Kozan Huseyin says:

    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.

  18. Ashoka says:

    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

  19. Ashoka says:

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

  20. ted says:

    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.

  21. BTP says:

    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?

  22. Martin Ashcroft says:

    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 :-)

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

  23. Marek says:

    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

  24. johnyrot says:

    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

  25. stve says:

    Josh this is nice, just what i wanted all along. keep it up

  26. iambrian says:

    awesome works beautifully
    maybe the wampserver folks should include this in their release

  27. parikhit says:

    i am getting this error “Socket Error # 11004″. how to fix this

  28. Paul says:

    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.

  29. Vijay says:

    Thank you guys worked like a charm for me…
    Thank you

  30. camwebworks says:

    hey,
    thanks a lot for the info..
    i was able to send mail using smtp.gmail.com
    using tls instead of ssl…
    Have a look at this – shows email configuration for both ssl and tsl
    http://mail.google.com/support/bin/answer.py?answer=13287

    where
    smtp_server=smtp.gmail.com

    smtp_port=587

    smtp_ssl=tls

    auth_username=gmail username
    auth_password=gmail password

    Enjoy!!!
    :)

  31. MilanG says:

    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!

  32. geremia.b says:

    I followed the tutorial and it works! All in few minutes!
    Good job!
    Thank you.

  33. Mads says:

    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

  34. Nate says:

    Nice, that worked like a charm!

  35. Rahul Sinha says:

    Works like a charm ..
    Very easy steps and great explanation

    Thanks Josh

  36. jay says:

    OMG….it works for me….i finally can send email through localhost….thanks a lot….

  37. Just wanted to say thank you for this…It worked well for me…

  38. This is a very helpful little tip, thank you for sharing :)

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

  40. John C says:

    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!

Trackbacks

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

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

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

Speak Your Mind

*