Send email from xampp localhost

Send email from xampp localhost. Follow the easy steps

  1. Goto http://glob.com.au/sendmail/, download latest sendmail package.
  2. Extract the zip file and copy the files into your xamppsendmail folder(Replace every file in the existing folder).
  3. Update the sendmail.ini file in sendmail folder with the following details, and make sure it is not commented(;).

    smtp_server=smtp.gmail.com
    smtp_port=25
    error_logfile=error.log
    debug_logfile=debug.log
    [email protected]
    auth_password=gmailpassword
    [email protected]

    Here i have added gmail account for sending emails.

  4. Open xamppphpphp.ini file find sendmail_path and update its value to ""C:xamppsendmailsendmail.exe" -t". Now it will look like below

    sendmail_path = ""C:xamppsendmailsendmail.exe" -t"

    Make sure it’s not commented(;)

  5. Restart your apache server.

Now you can send email from xampp localhost! enjoy πŸ™‚

40 Comments

 Add your comment
  1. Working perfect bro …

  2. I have completed every necessary steps and the message is also showing that the mail is sent but i am not receiving any mail at all, if there is any solution please inform me the same

  3. Hi Siraj,
    Thanks for your feedback. I was used this steps in Win XP localserver. It was worked on that time. I agree that currently this solution is not working for me also(Currently using Win 8). Soon i will update this post with right solution. Thanks!

  4. this is the perfect answer. but it is not possible to send message from xampp. it means i think you also can purchase the domain for do it.
    from the reply of the all internet users all says not work.. not work.. not work….
    And it is a very critical problem for every web developer.

  5. That did really solve my problem .. lolthank you very much Nathaniel

  6. Not Working For Me Man
    The Script Is Running Without error but i am not getting mail in myinbox

  7. Thanks working perfect

  8. Thanks for your post. I tried same but nothing happened.

    How can I solve it? How to check debug.log and error.log file. I do not see such file in sendmail folder.

    Thanks for your time.

  9. plz send me the details of sendmail in xammp using php in windows [email protected][email protected]

  10. Hi & thank you very much!
    I have tried many others instructions around the web and after a fat hour of trying nothing work for me!
    I think the key for me was outdated sendmail.exe (year 2009). So update instruction must be crucial.

    How to simply test outside of wordpress?

    1. Create PHP file with code:

    2. Execute

    Greetings, Jurij

  11. oh ok, just let me know if you're done with it πŸ™‚

  12. oh ok.. anyway i will try from my side!!

  13. OK, because I alreadry tried it and it didn't work πŸ™‚

  14. didn't have a chance to check it in windows 8 friend. I will try this and let you know πŸ™‚

  15. is it not working in windows 8?

  16. It is Working but "From:" address is changing
    From address is showing as we have give in the sendmail.ini can any one Help Me

  17. Hi Sharmishtha Rathod,
    Could you please elaborate your problem? so that we can help you, thanks! πŸ™‚

  18. hey …i am not able to send mail…

  19. Thanks man, i am a newbie to php and the code helps me a lot to test mail function locally…

  20. I think you could try changing the smtp_port:25 in senmail.ini file to smtp_port:587

  21. Benjie Brian Manalaysay

    Hi Can someone help me, I followed all the steps, But it's not working for me, Here's the content on my debug and error file:

    Error: 13/04/27 08:53:06 : Connect timed out.

    Debug:
    13/04/27 08:52:56 ** — MESSAGE BEGIN —
    13/04/27 08:52:56 ** To: [email protected]
    13/04/27 08:52:56 ** Subject: This is subject
    13/04/27 08:52:56 ** From:[email protected]
    13/04/27 08:52:56 **
    13/04/27 08:52:56 ** This is simple text message.
    13/04/27 08:52:56 ** — MESSAGE END —
    13/04/27 08:52:56 ** Connecting to smtp.gmail.com:25
    13/04/27 08:53:06 ** Disconnected.
    13/04/27 08:53:06 ** Disconnected.
    13/04/27 08:53:06 ** Disconnected.
    13/04/27 08:53:06 ** Disconnected.
    13/04/27 08:53:06 ** Connect timed out.

  22. I've tried all your steps. I've checked "error.log" and "debug.log" and its blank. No error found.

    This is my php code:
    —————————————————————
    $from = FROM_EMAIL;
    $to = TO_EMAIL;
    $subject = FHD_TITLE . ' New Registration';
    // message
    $message = '

    New Registration

    New User Registration
    Name: ' . $name . '
    Login: ' . $login . '
    Email: ' . $email . '

    ';
    $headers = "From:" . $from . "rn";
    $headers .="Reply-To: " . $from . "rn";
    $headers .="MIME-Version: 1.0" . "rn";
    $headers .="Content-type: text/html; charset=iso-8859-1" . "rn";
    if (mail($to, $subject, $message, $headers))
    {
    echo "Message Sent";
    }
    else
    {
    echo "Message Sending Failed";
    }

    Message appear on the page is "Message Sent". But no incoming email received.
    Can you help me with this?

  23. Hi Raj, please make sure that you have entered correct email and password, check your log files in sendmail folder to find what would be the problem

  24. Hi sunil, please check your debug.log and error.log file in sendmail folder to fine the error.

  25. Sunil Kumar Nerella

    Hello Karthik,

    I had done all the settings which were mentioned above but while sending the email, it shows that the mail have been sent but sent email address does't recieve any email from the sent mail….

    Can you explain why it had dappened…?

  26. Hi thanks for the PHP mail post its so clearly explaianed in,

    I am having issues receiving the mails sent from localhost, on my localhost the mailform.php is executed successfully without any error messages but unfortunately I am not receiving the same. Plz do the needful

  27. great post it solved my problem that arises during my project work

  28. Thanks for your comment sam:)

  29. Nice post! now i can able to send email from localhost. It ll help me to check email notifications to users after registration. Thank you karthik

  30. This comment has been removed by the author.

  31. It's not working for me on windows 7 .. Not error occur but my email id inbox have not accept any email from localhost.

  32. its not working i am using window 8.1.. I follow all the steps that are mentioned but still not able to send mail from localhost plz help me….

  33. its not working ..in error log .. connection time out why ?

  34. i am unable to send mail πŸ™

  35. plz send ur full code sir.bcoz myself not working….

  36. help me guyz i am behind the router and my email.php script says email sent but m not getting any email

  37. When send mail then show message sent but didn't received any mail and debug.log give these message

    15/12/17 00:56:14 ** — MESSAGE BEGIN —
    15/12/17 00:56:14 ** To: [email protected]
    15/12/17 00:56:14 ** Subject: Test mail
    15/12/17 00:56:14 **
    15/12/17 00:56:14 ** This is a test mail
    15/12/17 00:56:14 ** — MESSAGE END —
    15/12/17 00:56:14 ** Connecting to smtp.gmail.com:587
    15/12/17 00:56:15 ** Connected.
    15/12/17 00:56:15 << 220 smtp.gmail.com ESMTP r193sm6404693pfr.65 – gsmtp
    15/12/17 00:56:15 >> EHLO DATA-SERVER
    15/12/17 00:56:15 << 250-smtp.gmail.com at your service, [103.26.113.218]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    15/12/17 00:56:15 ** Authenticating as [email protected]
    15/12/17 00:56:15 >> STARTTLS
    15/12/17 00:56:16 << 220 2.0.0 Ready to start TLS
    15/12/17 00:56:16 >> EHLO DATA-SERVER
    15/12/17 00:56:16 << 250-smtp.gmail.com at your service, [103.26.113.218]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    15/12/17 00:56:16 >> AUTH LOGIN
    15/12/17 00:56:16 << 334 VXNlcm5hbWU6
    15/12/17 00:56:16 >> bS5iYXNoaXIwN0BnbWFpbC5jb20=
    15/12/17 00:56:17 << 334 UGFzc3dvcmQ6
    15/12/17 00:56:17 >> MzIxKmJhc2hpcg==
    15/12/17 00:56:17 << 534-5.7.14 534-5.7.14 vfZPrTMhB77ph5J959E06h0qAycU3BMz5nmUl0yPlVKigeDpPeTjw9P4Lwu-fmEOiEXCxR534-5.7.14 RNWokOSDINJzOehfEjXTt6OGI15QS_56nCdEeQ_jLVL0HMkm1kRUR7LQNi4WLCdIjG8WVK534-5.7.14 j_CKlZGiG6SRq5gL26WXWseFHHgVyqbbeM2u_wiY6QLOiTj7K_JnfRMCjbKyNFsEnRSZDZ534-5.7.14 zvOLNgzE4pO-PSo8vm_FPJzo7ZJk> Please log in via your web browser and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google.com/mail/answer/78754 r193sm6404693pfr.65 – gsmtp
    15/12/17 00:56:17 ** Disconnecting from smtp.gmail.com:587
    15/12/17 00:56:17 ** Disconnected.
    15/12/17 00:56:17 ** Disconnected.
    15/12/17 00:56:17 ** vfZPrTMhB77ph5J959E06h0qAycU3BMz5nmUl0yPlVKigeDpPeTjw9P4Lwu-fmEOiEXCxRRNWokOSDINJzOehfEjXTt6OGI15QS_56nCdEeQ_jLVL0HMkm1kRUR7LQNi4WLCdIjG8WVKj_CKlZGiG6SRq5gL26WXWseFHHgVyqbbeM2u_wiY6QLOiTj7K_JnfRMCjbKyNFsEnRSZDZzvOLNgzE4pO-PSo8vm_FPJzo7ZJk> Please log in via your web browser andthen try again. Learn more at https://support.google.com/mail/answer/78754 r193sm6404693pfr.65 – gsmtp

  38. it fails for me …. but thanks for sharing

  39. i followed your tutorials links but unable to receive the email and not getting mails from local xampp server .so could tell me that how to send a mail from local server ……thanks

Leave a Reply

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

%d bloggers like this: