How to configure XAMPP to send mail from localhost?












211















I am trying to send mail from localhost.
but i am unable to send the mail from localhost
so can anybody tell me that how to reconfigure my xampp to send mail from localhost










share|improve this question




















  • 3





    Can we see your code?

    – speeday125
    Apr 12 '13 at 7:21






  • 1





    Impossible to help if you don't give us the current configuration.

    – arkascha
    Apr 12 '13 at 7:22






  • 1





    Is this still relevant with Mercury included (ApacheFriends XAMPP 1.8.2)? I would think yes, but if there are people preferring Mercury, please indicate below. :) Thanks!

    – icedwater
    Jan 28 '14 at 7:21











  • Possible duplicate of sendmail.exe opens on sending mail

    – Pascal
    Jan 14 '16 at 6:49
















211















I am trying to send mail from localhost.
but i am unable to send the mail from localhost
so can anybody tell me that how to reconfigure my xampp to send mail from localhost










share|improve this question




















  • 3





    Can we see your code?

    – speeday125
    Apr 12 '13 at 7:21






  • 1





    Impossible to help if you don't give us the current configuration.

    – arkascha
    Apr 12 '13 at 7:22






  • 1





    Is this still relevant with Mercury included (ApacheFriends XAMPP 1.8.2)? I would think yes, but if there are people preferring Mercury, please indicate below. :) Thanks!

    – icedwater
    Jan 28 '14 at 7:21











  • Possible duplicate of sendmail.exe opens on sending mail

    – Pascal
    Jan 14 '16 at 6:49














211












211








211


138






I am trying to send mail from localhost.
but i am unable to send the mail from localhost
so can anybody tell me that how to reconfigure my xampp to send mail from localhost










share|improve this question
















I am trying to send mail from localhost.
but i am unable to send the mail from localhost
so can anybody tell me that how to reconfigure my xampp to send mail from localhost







php xampp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 12 '13 at 7:21









Raptor

34.9k31177290




34.9k31177290










asked Apr 12 '13 at 7:20









farid shaikhfarid shaikh

1,065383




1,065383








  • 3





    Can we see your code?

    – speeday125
    Apr 12 '13 at 7:21






  • 1





    Impossible to help if you don't give us the current configuration.

    – arkascha
    Apr 12 '13 at 7:22






  • 1





    Is this still relevant with Mercury included (ApacheFriends XAMPP 1.8.2)? I would think yes, but if there are people preferring Mercury, please indicate below. :) Thanks!

    – icedwater
    Jan 28 '14 at 7:21











  • Possible duplicate of sendmail.exe opens on sending mail

    – Pascal
    Jan 14 '16 at 6:49














  • 3





    Can we see your code?

    – speeday125
    Apr 12 '13 at 7:21






  • 1





    Impossible to help if you don't give us the current configuration.

    – arkascha
    Apr 12 '13 at 7:22






  • 1





    Is this still relevant with Mercury included (ApacheFriends XAMPP 1.8.2)? I would think yes, but if there are people preferring Mercury, please indicate below. :) Thanks!

    – icedwater
    Jan 28 '14 at 7:21











  • Possible duplicate of sendmail.exe opens on sending mail

    – Pascal
    Jan 14 '16 at 6:49








3




3





Can we see your code?

– speeday125
Apr 12 '13 at 7:21





Can we see your code?

– speeday125
Apr 12 '13 at 7:21




1




1





Impossible to help if you don't give us the current configuration.

– arkascha
Apr 12 '13 at 7:22





Impossible to help if you don't give us the current configuration.

– arkascha
Apr 12 '13 at 7:22




1




1





Is this still relevant with Mercury included (ApacheFriends XAMPP 1.8.2)? I would think yes, but if there are people preferring Mercury, please indicate below. :) Thanks!

– icedwater
Jan 28 '14 at 7:21





Is this still relevant with Mercury included (ApacheFriends XAMPP 1.8.2)? I would think yes, but if there are people preferring Mercury, please indicate below. :) Thanks!

– icedwater
Jan 28 '14 at 7:21













Possible duplicate of sendmail.exe opens on sending mail

– Pascal
Jan 14 '16 at 6:49





Possible duplicate of sendmail.exe opens on sending mail

– Pascal
Jan 14 '16 at 6:49












10 Answers
10






active

oldest

votes


















322














You can send mail from localhost with sendmail package , sendmail package is inbuild in XAMPP.
So if you are using XAMPP then you can easily send mail from localhost.



for example you can configure C:xamppphpphp.ini and c:xamppsendmailsendmail.ini for gmail to send mail.



in C:xamppphpphp.ini find extension=php_openssl.dll and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.



in php.ini file find [mail function] and change



SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = my-gmail-id@gmail.com
sendmail_path = ""C:xamppsendmailsendmail.exe" -t"


Now Open C:xamppsendmailsendmail.ini. Replace all the existing code in sendmail.ini with following code



[sendmail]

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=my-gmail-id@gmail.com
auth_password=my-gmail-password
force_sender=my-gmail-id@gmail.com


Now you have done!! create php file with mail function and send mail from localhost.



PS: don't forgot to replace my-gmail-id and my-gmail-password in above code.
Also, don't forget to remove duplicate keys if you copied settings from above. For example comment following line if there is another sendmail_path : sendmail_path="C:xamppmailtodiskmailtodisk.exe" in the php.ini file



Also remember to restart the server using the XAMMP control panel so the changes take effect.



For gmail please check https://support.google.com/accounts/answer/6010255 to allow access from less secure apps.




To send email on Linux (with sendmail package) through Gmail from
localhost please check PHP+Ubuntu Send email using gmail form
localhost.







share|improve this answer





















  • 2





    other than the configs above, i needed to update my sendmail glob.com.au/sendmail

    – kaz
    Sep 19 '13 at 6:10






  • 1





    I had to upgrade from XAMMP 1.7.7 to 2.8.2.3 -- sendmail is included in the newer XAMPP. I tried using a newer sendmail with 1.7.7 a few months ago and couldn't get it to work -- finally bit the bullet and used the new XAMPP and it works as described.

    – VanAlbert
    Jan 3 '14 at 22:00






  • 2





    I believe the location C:xamppphpphp.ini refers to windows environments. For mac look in xamppfiles/etc for your php.ini file.

    – Paul Trotter
    Oct 14 '14 at 10:46






  • 3





    @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as Thirumalai murugan answer has stated actually fixed it for me

    – Temitayo
    Oct 28 '14 at 7:38






  • 3





    It is only for gmail? thanks..

    – pcs
    May 23 '15 at 4:09



















33














In XAMPP v3.2.1 for testing purposes you can see the emails that the XAMPP sends in XAMPP/mailoutput. In my case on Windows 8 this did not require any additional configuration and was a simple solution to testing email






share|improve this answer
























  • And if this isn't working, check your c:xamppphpphp.ini, look for [mail function], and uncomment the line that mentions mailtodisk.exe. Keep every other line in this section commented out except for the mail.add_x_header one.

    – Tim Malone
    May 10 '16 at 5:33






  • 3





    As an addemdum to my comment above, for the more recent versions of XAMPP, you may need to manually add the mailtodisk line. It should look something like this: sendmail_path="C:xamppmailtodiskmailtodisk.exe"

    – Tim Malone
    Nov 16 '16 at 21:46











  • An additional addendum to comment from @TimMalone. I found that mail would only be written to XAMPP/mailoutput if running XAMPP as admin

    – sohail
    Apr 10 '18 at 16:02











  • @sohail: You don't have to run XAMPP as admin but you have to give permission for all users to write to the folder XAMPP/mailoutput (right click on folder > security > all users > edit permissions > full access)

    – cheppsn
    Jul 31 '18 at 14:06



















23














Its very simple to send emails on localhost or local server



Note: I am using the test mail server software on Windows 7 64bit with Xampp installed



Just download test mail server tool and install according to the instruction given on its website Test Mail Server Tool



Now you need to change only two lines under php.ini file




  1. Find [mail function] and remove semi colon which is before ;smtp = localhost

  2. Put the semi colon before sendmail_path = "C:xamppmailtodiskmailtodisk.exe"


You don't need to change anything else, but if you still not getting emails than check for the SMTP port, the port number must be same.



The above method is for default settings provided by the Xampp software.






share|improve this answer





















  • 6





    If you don't trust that site, you might want to use papercut from codeplex instead: papercut.codeplex.com.

    – Marcel Burkhard
    Mar 30 '15 at 9:00











  • I did not have to do anything to make it work, just install it.

    – vonUbisch
    Jul 8 '15 at 8:08











  • I just had to change the port though

    – Pablo S G Pacheco
    Dec 13 '18 at 21:29



















18














You have to configure SMTP on your server. You can use G Suite SMTP by Google for free:



<?php

$mail = new PHPMailer(true);

// Send mail using Gmail
if($send_using_gmail){
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "your-gmail-account@gmail.com"; // GMAIL username
$mail->Password = "your-gmail-password"; // GMAIL password
}

// Typical mail data
$mail->AddAddress($email, $name);
$mail->SetFrom($email_from, $name_from);
$mail->Subject = "My Subject";
$mail->Body = "Mail contents";

try{
$mail->Send();
echo "Success!";
} catch(Exception $e){
// Something went bad
echo "Fail :(";
}

?>


Read more about PHPMailer here.






share|improve this answer


























  • @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as this answer has stated actually fixed it for me

    – Temitayo
    Oct 28 '14 at 7:38











  • @Temitayo have you tried my answer?

    – Thirumalai murugan
    Oct 28 '14 at 8:51











  • Iused @Vikas answer but I used a fragment from yours i.e. using 465 as emtp_port. Good work anyway

    – Temitayo
    Nov 1 '14 at 22:35











  • Fatal error: Class 'PHPMailer' not found in C:xampphtdocsmywebemail_script.php on line 82

    – Shafizadeh
    Feb 13 '16 at 16:17











  • you have to download the phpmailer github.com/Synchro/PHPMailer

    – Thirumalai murugan
    Feb 16 '16 at 6:10





















12














You can test send mail in Your PC without Internet



you should use Papercut this simple application to test send mail. and you don't need to configure anything.



Just run it and try test send mail:



test_sendmail.php



<?php
$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com" . "rn" .
"CC: somebodyelse@example.com";

mail($to,$subject,$txt,$headers);
?>


and you will see this:



enter image description here



I hope you will have a good day.
you can find me on Youtube for more tutorial Piseth Sok



Cheer!






share|improve this answer































    5














    For people on windows 8 if you want to do this i would really recommend reading this tutorial i found: http://yogeshchaugule.com/blog/2013/configure-sendmail-wamp



    Its not written by me but after slamming my head into a concrete wall for 2,5 hours not getting this to work with the weirdest errors like:




    • Connection timed out.

    • Connection Closed Gracefully.


    I finally found that tutorial were upon installation of https://www.stunnel.org/downloads.html and the configuration of Stunnel. It finally worked.






    share|improve this answer
























    • I had the exact same issue (Connection Closed Gracefully) and I was able to fix it by installing stunnel by following the steps mentioned here: digiex.net/guides-reviews/guides-tutorials/application-guides/… with a very slight change, I had to comment the output, debug and socket parameters from stunnel.conf as they were throwing an error. Upvoted.

      – Special K.
      Jun 23 '14 at 18:46



















    1














    If you have an installed copy of xampp latest copy then check this link for complete documentation of sending emails through xampp. You must enable apache before you try to access the below link



    http://localhost/dashboard/docs/send-mail.html






    share|improve this answer































      0














      You have to define an SMTP server and a port for this. All except like sending mails from live hosts.



      This is a useful link regarding this.




      NB: The port should be unused. Please take care that, Some
      applications like Skype uses the default ports and there by prevents
      sending mail.







      share|improve this answer
























      • You can prevent skype from using port 80. its on connection settings of skype

        – astroanu
        Jan 27 '15 at 3:54



















      0














      just spent over an hour trying to make this work. for everybody having the same trouble with all the suggestions posted not working: you have to restart Apache in your XAMPP inrerface! just restarting XAMPP wont work!!






      share|improve this answer































        0














        As in my personal experience I found that very similar thing to Vikas Dwivedi answer will work just fine.



        Step 1 (php.ini file)




        In php.ini file located in xamppphpphp.ini. Change settings to the following:



        extension=php_openssl.dll
        [mail function]
        sendmail_path =":xampp7sendmailsendmail.exe -t"
        mail.add_x_header=On


        Turn off other variables under mail funciton by putting ; before them. e.g ;smtp_port=25




        Step 2 (sendmail.ini file)




        In sendmail.ini located in xamppsendmailsemdmail.ini change to the
        following:



        smtp_server=smtp.gmail.com
        smtp_port=465
        smtp_ssl=auto
        auth_username=address@gmail.com
        auth_password=YourPassword



        Step 3 (code)




        Create a php file and use the following:



        <?php
        mail($to, "subject", "body", "From: ".$from);
        ?>



        Notice




        • You need to restart apache in order for php.ini to reload.

        • you need to activate Google Less secure app access in https://myaccount.google.com/u/1/security

        • It might help to run Xampp with Admin permission.






        share|improve this answer
























          protected by Community Jan 11 '15 at 9:06



          Thank you for your interest in this question.
          Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



          Would you like to answer one of these unanswered questions instead?














          10 Answers
          10






          active

          oldest

          votes








          10 Answers
          10






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          322














          You can send mail from localhost with sendmail package , sendmail package is inbuild in XAMPP.
          So if you are using XAMPP then you can easily send mail from localhost.



          for example you can configure C:xamppphpphp.ini and c:xamppsendmailsendmail.ini for gmail to send mail.



          in C:xamppphpphp.ini find extension=php_openssl.dll and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.



          in php.ini file find [mail function] and change



          SMTP=smtp.gmail.com
          smtp_port=587
          sendmail_from = my-gmail-id@gmail.com
          sendmail_path = ""C:xamppsendmailsendmail.exe" -t"


          Now Open C:xamppsendmailsendmail.ini. Replace all the existing code in sendmail.ini with following code



          [sendmail]

          smtp_server=smtp.gmail.com
          smtp_port=587
          error_logfile=error.log
          debug_logfile=debug.log
          auth_username=my-gmail-id@gmail.com
          auth_password=my-gmail-password
          force_sender=my-gmail-id@gmail.com


          Now you have done!! create php file with mail function and send mail from localhost.



          PS: don't forgot to replace my-gmail-id and my-gmail-password in above code.
          Also, don't forget to remove duplicate keys if you copied settings from above. For example comment following line if there is another sendmail_path : sendmail_path="C:xamppmailtodiskmailtodisk.exe" in the php.ini file



          Also remember to restart the server using the XAMMP control panel so the changes take effect.



          For gmail please check https://support.google.com/accounts/answer/6010255 to allow access from less secure apps.




          To send email on Linux (with sendmail package) through Gmail from
          localhost please check PHP+Ubuntu Send email using gmail form
          localhost.







          share|improve this answer





















          • 2





            other than the configs above, i needed to update my sendmail glob.com.au/sendmail

            – kaz
            Sep 19 '13 at 6:10






          • 1





            I had to upgrade from XAMMP 1.7.7 to 2.8.2.3 -- sendmail is included in the newer XAMPP. I tried using a newer sendmail with 1.7.7 a few months ago and couldn't get it to work -- finally bit the bullet and used the new XAMPP and it works as described.

            – VanAlbert
            Jan 3 '14 at 22:00






          • 2





            I believe the location C:xamppphpphp.ini refers to windows environments. For mac look in xamppfiles/etc for your php.ini file.

            – Paul Trotter
            Oct 14 '14 at 10:46






          • 3





            @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as Thirumalai murugan answer has stated actually fixed it for me

            – Temitayo
            Oct 28 '14 at 7:38






          • 3





            It is only for gmail? thanks..

            – pcs
            May 23 '15 at 4:09
















          322














          You can send mail from localhost with sendmail package , sendmail package is inbuild in XAMPP.
          So if you are using XAMPP then you can easily send mail from localhost.



          for example you can configure C:xamppphpphp.ini and c:xamppsendmailsendmail.ini for gmail to send mail.



          in C:xamppphpphp.ini find extension=php_openssl.dll and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.



          in php.ini file find [mail function] and change



          SMTP=smtp.gmail.com
          smtp_port=587
          sendmail_from = my-gmail-id@gmail.com
          sendmail_path = ""C:xamppsendmailsendmail.exe" -t"


          Now Open C:xamppsendmailsendmail.ini. Replace all the existing code in sendmail.ini with following code



          [sendmail]

          smtp_server=smtp.gmail.com
          smtp_port=587
          error_logfile=error.log
          debug_logfile=debug.log
          auth_username=my-gmail-id@gmail.com
          auth_password=my-gmail-password
          force_sender=my-gmail-id@gmail.com


          Now you have done!! create php file with mail function and send mail from localhost.



          PS: don't forgot to replace my-gmail-id and my-gmail-password in above code.
          Also, don't forget to remove duplicate keys if you copied settings from above. For example comment following line if there is another sendmail_path : sendmail_path="C:xamppmailtodiskmailtodisk.exe" in the php.ini file



          Also remember to restart the server using the XAMMP control panel so the changes take effect.



          For gmail please check https://support.google.com/accounts/answer/6010255 to allow access from less secure apps.




          To send email on Linux (with sendmail package) through Gmail from
          localhost please check PHP+Ubuntu Send email using gmail form
          localhost.







          share|improve this answer





















          • 2





            other than the configs above, i needed to update my sendmail glob.com.au/sendmail

            – kaz
            Sep 19 '13 at 6:10






          • 1





            I had to upgrade from XAMMP 1.7.7 to 2.8.2.3 -- sendmail is included in the newer XAMPP. I tried using a newer sendmail with 1.7.7 a few months ago and couldn't get it to work -- finally bit the bullet and used the new XAMPP and it works as described.

            – VanAlbert
            Jan 3 '14 at 22:00






          • 2





            I believe the location C:xamppphpphp.ini refers to windows environments. For mac look in xamppfiles/etc for your php.ini file.

            – Paul Trotter
            Oct 14 '14 at 10:46






          • 3





            @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as Thirumalai murugan answer has stated actually fixed it for me

            – Temitayo
            Oct 28 '14 at 7:38






          • 3





            It is only for gmail? thanks..

            – pcs
            May 23 '15 at 4:09














          322












          322








          322







          You can send mail from localhost with sendmail package , sendmail package is inbuild in XAMPP.
          So if you are using XAMPP then you can easily send mail from localhost.



          for example you can configure C:xamppphpphp.ini and c:xamppsendmailsendmail.ini for gmail to send mail.



          in C:xamppphpphp.ini find extension=php_openssl.dll and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.



          in php.ini file find [mail function] and change



          SMTP=smtp.gmail.com
          smtp_port=587
          sendmail_from = my-gmail-id@gmail.com
          sendmail_path = ""C:xamppsendmailsendmail.exe" -t"


          Now Open C:xamppsendmailsendmail.ini. Replace all the existing code in sendmail.ini with following code



          [sendmail]

          smtp_server=smtp.gmail.com
          smtp_port=587
          error_logfile=error.log
          debug_logfile=debug.log
          auth_username=my-gmail-id@gmail.com
          auth_password=my-gmail-password
          force_sender=my-gmail-id@gmail.com


          Now you have done!! create php file with mail function and send mail from localhost.



          PS: don't forgot to replace my-gmail-id and my-gmail-password in above code.
          Also, don't forget to remove duplicate keys if you copied settings from above. For example comment following line if there is another sendmail_path : sendmail_path="C:xamppmailtodiskmailtodisk.exe" in the php.ini file



          Also remember to restart the server using the XAMMP control panel so the changes take effect.



          For gmail please check https://support.google.com/accounts/answer/6010255 to allow access from less secure apps.




          To send email on Linux (with sendmail package) through Gmail from
          localhost please check PHP+Ubuntu Send email using gmail form
          localhost.







          share|improve this answer















          You can send mail from localhost with sendmail package , sendmail package is inbuild in XAMPP.
          So if you are using XAMPP then you can easily send mail from localhost.



          for example you can configure C:xamppphpphp.ini and c:xamppsendmailsendmail.ini for gmail to send mail.



          in C:xamppphpphp.ini find extension=php_openssl.dll and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.



          in php.ini file find [mail function] and change



          SMTP=smtp.gmail.com
          smtp_port=587
          sendmail_from = my-gmail-id@gmail.com
          sendmail_path = ""C:xamppsendmailsendmail.exe" -t"


          Now Open C:xamppsendmailsendmail.ini. Replace all the existing code in sendmail.ini with following code



          [sendmail]

          smtp_server=smtp.gmail.com
          smtp_port=587
          error_logfile=error.log
          debug_logfile=debug.log
          auth_username=my-gmail-id@gmail.com
          auth_password=my-gmail-password
          force_sender=my-gmail-id@gmail.com


          Now you have done!! create php file with mail function and send mail from localhost.



          PS: don't forgot to replace my-gmail-id and my-gmail-password in above code.
          Also, don't forget to remove duplicate keys if you copied settings from above. For example comment following line if there is another sendmail_path : sendmail_path="C:xamppmailtodiskmailtodisk.exe" in the php.ini file



          Also remember to restart the server using the XAMMP control panel so the changes take effect.



          For gmail please check https://support.google.com/accounts/answer/6010255 to allow access from less secure apps.




          To send email on Linux (with sendmail package) through Gmail from
          localhost please check PHP+Ubuntu Send email using gmail form
          localhost.








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 16 '17 at 6:07

























          answered Aug 12 '13 at 10:57









          Vikas DwivediVikas Dwivedi

          3,52911211




          3,52911211








          • 2





            other than the configs above, i needed to update my sendmail glob.com.au/sendmail

            – kaz
            Sep 19 '13 at 6:10






          • 1





            I had to upgrade from XAMMP 1.7.7 to 2.8.2.3 -- sendmail is included in the newer XAMPP. I tried using a newer sendmail with 1.7.7 a few months ago and couldn't get it to work -- finally bit the bullet and used the new XAMPP and it works as described.

            – VanAlbert
            Jan 3 '14 at 22:00






          • 2





            I believe the location C:xamppphpphp.ini refers to windows environments. For mac look in xamppfiles/etc for your php.ini file.

            – Paul Trotter
            Oct 14 '14 at 10:46






          • 3





            @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as Thirumalai murugan answer has stated actually fixed it for me

            – Temitayo
            Oct 28 '14 at 7:38






          • 3





            It is only for gmail? thanks..

            – pcs
            May 23 '15 at 4:09














          • 2





            other than the configs above, i needed to update my sendmail glob.com.au/sendmail

            – kaz
            Sep 19 '13 at 6:10






          • 1





            I had to upgrade from XAMMP 1.7.7 to 2.8.2.3 -- sendmail is included in the newer XAMPP. I tried using a newer sendmail with 1.7.7 a few months ago and couldn't get it to work -- finally bit the bullet and used the new XAMPP and it works as described.

            – VanAlbert
            Jan 3 '14 at 22:00






          • 2





            I believe the location C:xamppphpphp.ini refers to windows environments. For mac look in xamppfiles/etc for your php.ini file.

            – Paul Trotter
            Oct 14 '14 at 10:46






          • 3





            @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as Thirumalai murugan answer has stated actually fixed it for me

            – Temitayo
            Oct 28 '14 at 7:38






          • 3





            It is only for gmail? thanks..

            – pcs
            May 23 '15 at 4:09








          2




          2





          other than the configs above, i needed to update my sendmail glob.com.au/sendmail

          – kaz
          Sep 19 '13 at 6:10





          other than the configs above, i needed to update my sendmail glob.com.au/sendmail

          – kaz
          Sep 19 '13 at 6:10




          1




          1





          I had to upgrade from XAMMP 1.7.7 to 2.8.2.3 -- sendmail is included in the newer XAMPP. I tried using a newer sendmail with 1.7.7 a few months ago and couldn't get it to work -- finally bit the bullet and used the new XAMPP and it works as described.

          – VanAlbert
          Jan 3 '14 at 22:00





          I had to upgrade from XAMMP 1.7.7 to 2.8.2.3 -- sendmail is included in the newer XAMPP. I tried using a newer sendmail with 1.7.7 a few months ago and couldn't get it to work -- finally bit the bullet and used the new XAMPP and it works as described.

          – VanAlbert
          Jan 3 '14 at 22:00




          2




          2





          I believe the location C:xamppphpphp.ini refers to windows environments. For mac look in xamppfiles/etc for your php.ini file.

          – Paul Trotter
          Oct 14 '14 at 10:46





          I believe the location C:xamppphpphp.ini refers to windows environments. For mac look in xamppfiles/etc for your php.ini file.

          – Paul Trotter
          Oct 14 '14 at 10:46




          3




          3





          @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as Thirumalai murugan answer has stated actually fixed it for me

          – Temitayo
          Oct 28 '14 at 7:38





          @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as Thirumalai murugan answer has stated actually fixed it for me

          – Temitayo
          Oct 28 '14 at 7:38




          3




          3





          It is only for gmail? thanks..

          – pcs
          May 23 '15 at 4:09





          It is only for gmail? thanks..

          – pcs
          May 23 '15 at 4:09













          33














          In XAMPP v3.2.1 for testing purposes you can see the emails that the XAMPP sends in XAMPP/mailoutput. In my case on Windows 8 this did not require any additional configuration and was a simple solution to testing email






          share|improve this answer
























          • And if this isn't working, check your c:xamppphpphp.ini, look for [mail function], and uncomment the line that mentions mailtodisk.exe. Keep every other line in this section commented out except for the mail.add_x_header one.

            – Tim Malone
            May 10 '16 at 5:33






          • 3





            As an addemdum to my comment above, for the more recent versions of XAMPP, you may need to manually add the mailtodisk line. It should look something like this: sendmail_path="C:xamppmailtodiskmailtodisk.exe"

            – Tim Malone
            Nov 16 '16 at 21:46











          • An additional addendum to comment from @TimMalone. I found that mail would only be written to XAMPP/mailoutput if running XAMPP as admin

            – sohail
            Apr 10 '18 at 16:02











          • @sohail: You don't have to run XAMPP as admin but you have to give permission for all users to write to the folder XAMPP/mailoutput (right click on folder > security > all users > edit permissions > full access)

            – cheppsn
            Jul 31 '18 at 14:06
















          33














          In XAMPP v3.2.1 for testing purposes you can see the emails that the XAMPP sends in XAMPP/mailoutput. In my case on Windows 8 this did not require any additional configuration and was a simple solution to testing email






          share|improve this answer
























          • And if this isn't working, check your c:xamppphpphp.ini, look for [mail function], and uncomment the line that mentions mailtodisk.exe. Keep every other line in this section commented out except for the mail.add_x_header one.

            – Tim Malone
            May 10 '16 at 5:33






          • 3





            As an addemdum to my comment above, for the more recent versions of XAMPP, you may need to manually add the mailtodisk line. It should look something like this: sendmail_path="C:xamppmailtodiskmailtodisk.exe"

            – Tim Malone
            Nov 16 '16 at 21:46











          • An additional addendum to comment from @TimMalone. I found that mail would only be written to XAMPP/mailoutput if running XAMPP as admin

            – sohail
            Apr 10 '18 at 16:02











          • @sohail: You don't have to run XAMPP as admin but you have to give permission for all users to write to the folder XAMPP/mailoutput (right click on folder > security > all users > edit permissions > full access)

            – cheppsn
            Jul 31 '18 at 14:06














          33












          33








          33







          In XAMPP v3.2.1 for testing purposes you can see the emails that the XAMPP sends in XAMPP/mailoutput. In my case on Windows 8 this did not require any additional configuration and was a simple solution to testing email






          share|improve this answer













          In XAMPP v3.2.1 for testing purposes you can see the emails that the XAMPP sends in XAMPP/mailoutput. In my case on Windows 8 this did not require any additional configuration and was a simple solution to testing email







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 13 '15 at 13:41









          Paul TrotterPaul Trotter

          492512




          492512













          • And if this isn't working, check your c:xamppphpphp.ini, look for [mail function], and uncomment the line that mentions mailtodisk.exe. Keep every other line in this section commented out except for the mail.add_x_header one.

            – Tim Malone
            May 10 '16 at 5:33






          • 3





            As an addemdum to my comment above, for the more recent versions of XAMPP, you may need to manually add the mailtodisk line. It should look something like this: sendmail_path="C:xamppmailtodiskmailtodisk.exe"

            – Tim Malone
            Nov 16 '16 at 21:46











          • An additional addendum to comment from @TimMalone. I found that mail would only be written to XAMPP/mailoutput if running XAMPP as admin

            – sohail
            Apr 10 '18 at 16:02











          • @sohail: You don't have to run XAMPP as admin but you have to give permission for all users to write to the folder XAMPP/mailoutput (right click on folder > security > all users > edit permissions > full access)

            – cheppsn
            Jul 31 '18 at 14:06



















          • And if this isn't working, check your c:xamppphpphp.ini, look for [mail function], and uncomment the line that mentions mailtodisk.exe. Keep every other line in this section commented out except for the mail.add_x_header one.

            – Tim Malone
            May 10 '16 at 5:33






          • 3





            As an addemdum to my comment above, for the more recent versions of XAMPP, you may need to manually add the mailtodisk line. It should look something like this: sendmail_path="C:xamppmailtodiskmailtodisk.exe"

            – Tim Malone
            Nov 16 '16 at 21:46











          • An additional addendum to comment from @TimMalone. I found that mail would only be written to XAMPP/mailoutput if running XAMPP as admin

            – sohail
            Apr 10 '18 at 16:02











          • @sohail: You don't have to run XAMPP as admin but you have to give permission for all users to write to the folder XAMPP/mailoutput (right click on folder > security > all users > edit permissions > full access)

            – cheppsn
            Jul 31 '18 at 14:06

















          And if this isn't working, check your c:xamppphpphp.ini, look for [mail function], and uncomment the line that mentions mailtodisk.exe. Keep every other line in this section commented out except for the mail.add_x_header one.

          – Tim Malone
          May 10 '16 at 5:33





          And if this isn't working, check your c:xamppphpphp.ini, look for [mail function], and uncomment the line that mentions mailtodisk.exe. Keep every other line in this section commented out except for the mail.add_x_header one.

          – Tim Malone
          May 10 '16 at 5:33




          3




          3





          As an addemdum to my comment above, for the more recent versions of XAMPP, you may need to manually add the mailtodisk line. It should look something like this: sendmail_path="C:xamppmailtodiskmailtodisk.exe"

          – Tim Malone
          Nov 16 '16 at 21:46





          As an addemdum to my comment above, for the more recent versions of XAMPP, you may need to manually add the mailtodisk line. It should look something like this: sendmail_path="C:xamppmailtodiskmailtodisk.exe"

          – Tim Malone
          Nov 16 '16 at 21:46













          An additional addendum to comment from @TimMalone. I found that mail would only be written to XAMPP/mailoutput if running XAMPP as admin

          – sohail
          Apr 10 '18 at 16:02





          An additional addendum to comment from @TimMalone. I found that mail would only be written to XAMPP/mailoutput if running XAMPP as admin

          – sohail
          Apr 10 '18 at 16:02













          @sohail: You don't have to run XAMPP as admin but you have to give permission for all users to write to the folder XAMPP/mailoutput (right click on folder > security > all users > edit permissions > full access)

          – cheppsn
          Jul 31 '18 at 14:06





          @sohail: You don't have to run XAMPP as admin but you have to give permission for all users to write to the folder XAMPP/mailoutput (right click on folder > security > all users > edit permissions > full access)

          – cheppsn
          Jul 31 '18 at 14:06











          23














          Its very simple to send emails on localhost or local server



          Note: I am using the test mail server software on Windows 7 64bit with Xampp installed



          Just download test mail server tool and install according to the instruction given on its website Test Mail Server Tool



          Now you need to change only two lines under php.ini file




          1. Find [mail function] and remove semi colon which is before ;smtp = localhost

          2. Put the semi colon before sendmail_path = "C:xamppmailtodiskmailtodisk.exe"


          You don't need to change anything else, but if you still not getting emails than check for the SMTP port, the port number must be same.



          The above method is for default settings provided by the Xampp software.






          share|improve this answer





















          • 6





            If you don't trust that site, you might want to use papercut from codeplex instead: papercut.codeplex.com.

            – Marcel Burkhard
            Mar 30 '15 at 9:00











          • I did not have to do anything to make it work, just install it.

            – vonUbisch
            Jul 8 '15 at 8:08











          • I just had to change the port though

            – Pablo S G Pacheco
            Dec 13 '18 at 21:29
















          23














          Its very simple to send emails on localhost or local server



          Note: I am using the test mail server software on Windows 7 64bit with Xampp installed



          Just download test mail server tool and install according to the instruction given on its website Test Mail Server Tool



          Now you need to change only two lines under php.ini file




          1. Find [mail function] and remove semi colon which is before ;smtp = localhost

          2. Put the semi colon before sendmail_path = "C:xamppmailtodiskmailtodisk.exe"


          You don't need to change anything else, but if you still not getting emails than check for the SMTP port, the port number must be same.



          The above method is for default settings provided by the Xampp software.






          share|improve this answer





















          • 6





            If you don't trust that site, you might want to use papercut from codeplex instead: papercut.codeplex.com.

            – Marcel Burkhard
            Mar 30 '15 at 9:00











          • I did not have to do anything to make it work, just install it.

            – vonUbisch
            Jul 8 '15 at 8:08











          • I just had to change the port though

            – Pablo S G Pacheco
            Dec 13 '18 at 21:29














          23












          23








          23







          Its very simple to send emails on localhost or local server



          Note: I am using the test mail server software on Windows 7 64bit with Xampp installed



          Just download test mail server tool and install according to the instruction given on its website Test Mail Server Tool



          Now you need to change only two lines under php.ini file




          1. Find [mail function] and remove semi colon which is before ;smtp = localhost

          2. Put the semi colon before sendmail_path = "C:xamppmailtodiskmailtodisk.exe"


          You don't need to change anything else, but if you still not getting emails than check for the SMTP port, the port number must be same.



          The above method is for default settings provided by the Xampp software.






          share|improve this answer















          Its very simple to send emails on localhost or local server



          Note: I am using the test mail server software on Windows 7 64bit with Xampp installed



          Just download test mail server tool and install according to the instruction given on its website Test Mail Server Tool



          Now you need to change only two lines under php.ini file




          1. Find [mail function] and remove semi colon which is before ;smtp = localhost

          2. Put the semi colon before sendmail_path = "C:xamppmailtodiskmailtodisk.exe"


          You don't need to change anything else, but if you still not getting emails than check for the SMTP port, the port number must be same.



          The above method is for default settings provided by the Xampp software.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 22 '17 at 8:48

























          answered Apr 14 '14 at 13:21









          Vikas KhuntetaVikas Khunteta

          925914




          925914








          • 6





            If you don't trust that site, you might want to use papercut from codeplex instead: papercut.codeplex.com.

            – Marcel Burkhard
            Mar 30 '15 at 9:00











          • I did not have to do anything to make it work, just install it.

            – vonUbisch
            Jul 8 '15 at 8:08











          • I just had to change the port though

            – Pablo S G Pacheco
            Dec 13 '18 at 21:29














          • 6





            If you don't trust that site, you might want to use papercut from codeplex instead: papercut.codeplex.com.

            – Marcel Burkhard
            Mar 30 '15 at 9:00











          • I did not have to do anything to make it work, just install it.

            – vonUbisch
            Jul 8 '15 at 8:08











          • I just had to change the port though

            – Pablo S G Pacheco
            Dec 13 '18 at 21:29








          6




          6





          If you don't trust that site, you might want to use papercut from codeplex instead: papercut.codeplex.com.

          – Marcel Burkhard
          Mar 30 '15 at 9:00





          If you don't trust that site, you might want to use papercut from codeplex instead: papercut.codeplex.com.

          – Marcel Burkhard
          Mar 30 '15 at 9:00













          I did not have to do anything to make it work, just install it.

          – vonUbisch
          Jul 8 '15 at 8:08





          I did not have to do anything to make it work, just install it.

          – vonUbisch
          Jul 8 '15 at 8:08













          I just had to change the port though

          – Pablo S G Pacheco
          Dec 13 '18 at 21:29





          I just had to change the port though

          – Pablo S G Pacheco
          Dec 13 '18 at 21:29











          18














          You have to configure SMTP on your server. You can use G Suite SMTP by Google for free:



          <?php

          $mail = new PHPMailer(true);

          // Send mail using Gmail
          if($send_using_gmail){
          $mail->IsSMTP(); // telling the class to use SMTP
          $mail->SMTPAuth = true; // enable SMTP authentication
          $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
          $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
          $mail->Port = 465; // set the SMTP port for the GMAIL server
          $mail->Username = "your-gmail-account@gmail.com"; // GMAIL username
          $mail->Password = "your-gmail-password"; // GMAIL password
          }

          // Typical mail data
          $mail->AddAddress($email, $name);
          $mail->SetFrom($email_from, $name_from);
          $mail->Subject = "My Subject";
          $mail->Body = "Mail contents";

          try{
          $mail->Send();
          echo "Success!";
          } catch(Exception $e){
          // Something went bad
          echo "Fail :(";
          }

          ?>


          Read more about PHPMailer here.






          share|improve this answer


























          • @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as this answer has stated actually fixed it for me

            – Temitayo
            Oct 28 '14 at 7:38











          • @Temitayo have you tried my answer?

            – Thirumalai murugan
            Oct 28 '14 at 8:51











          • Iused @Vikas answer but I used a fragment from yours i.e. using 465 as emtp_port. Good work anyway

            – Temitayo
            Nov 1 '14 at 22:35











          • Fatal error: Class 'PHPMailer' not found in C:xampphtdocsmywebemail_script.php on line 82

            – Shafizadeh
            Feb 13 '16 at 16:17











          • you have to download the phpmailer github.com/Synchro/PHPMailer

            – Thirumalai murugan
            Feb 16 '16 at 6:10


















          18














          You have to configure SMTP on your server. You can use G Suite SMTP by Google for free:



          <?php

          $mail = new PHPMailer(true);

          // Send mail using Gmail
          if($send_using_gmail){
          $mail->IsSMTP(); // telling the class to use SMTP
          $mail->SMTPAuth = true; // enable SMTP authentication
          $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
          $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
          $mail->Port = 465; // set the SMTP port for the GMAIL server
          $mail->Username = "your-gmail-account@gmail.com"; // GMAIL username
          $mail->Password = "your-gmail-password"; // GMAIL password
          }

          // Typical mail data
          $mail->AddAddress($email, $name);
          $mail->SetFrom($email_from, $name_from);
          $mail->Subject = "My Subject";
          $mail->Body = "Mail contents";

          try{
          $mail->Send();
          echo "Success!";
          } catch(Exception $e){
          // Something went bad
          echo "Fail :(";
          }

          ?>


          Read more about PHPMailer here.






          share|improve this answer


























          • @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as this answer has stated actually fixed it for me

            – Temitayo
            Oct 28 '14 at 7:38











          • @Temitayo have you tried my answer?

            – Thirumalai murugan
            Oct 28 '14 at 8:51











          • Iused @Vikas answer but I used a fragment from yours i.e. using 465 as emtp_port. Good work anyway

            – Temitayo
            Nov 1 '14 at 22:35











          • Fatal error: Class 'PHPMailer' not found in C:xampphtdocsmywebemail_script.php on line 82

            – Shafizadeh
            Feb 13 '16 at 16:17











          • you have to download the phpmailer github.com/Synchro/PHPMailer

            – Thirumalai murugan
            Feb 16 '16 at 6:10
















          18












          18








          18







          You have to configure SMTP on your server. You can use G Suite SMTP by Google for free:



          <?php

          $mail = new PHPMailer(true);

          // Send mail using Gmail
          if($send_using_gmail){
          $mail->IsSMTP(); // telling the class to use SMTP
          $mail->SMTPAuth = true; // enable SMTP authentication
          $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
          $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
          $mail->Port = 465; // set the SMTP port for the GMAIL server
          $mail->Username = "your-gmail-account@gmail.com"; // GMAIL username
          $mail->Password = "your-gmail-password"; // GMAIL password
          }

          // Typical mail data
          $mail->AddAddress($email, $name);
          $mail->SetFrom($email_from, $name_from);
          $mail->Subject = "My Subject";
          $mail->Body = "Mail contents";

          try{
          $mail->Send();
          echo "Success!";
          } catch(Exception $e){
          // Something went bad
          echo "Fail :(";
          }

          ?>


          Read more about PHPMailer here.






          share|improve this answer















          You have to configure SMTP on your server. You can use G Suite SMTP by Google for free:



          <?php

          $mail = new PHPMailer(true);

          // Send mail using Gmail
          if($send_using_gmail){
          $mail->IsSMTP(); // telling the class to use SMTP
          $mail->SMTPAuth = true; // enable SMTP authentication
          $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
          $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
          $mail->Port = 465; // set the SMTP port for the GMAIL server
          $mail->Username = "your-gmail-account@gmail.com"; // GMAIL username
          $mail->Password = "your-gmail-password"; // GMAIL password
          }

          // Typical mail data
          $mail->AddAddress($email, $name);
          $mail->SetFrom($email_from, $name_from);
          $mail->Subject = "My Subject";
          $mail->Body = "Mail contents";

          try{
          $mail->Send();
          echo "Success!";
          } catch(Exception $e){
          // Something went bad
          echo "Fail :(";
          }

          ?>


          Read more about PHPMailer here.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 25 '17 at 21:17









          Hristiyan Dodov

          1,75711425




          1,75711425










          answered Apr 12 '13 at 7:25









          Thirumalai muruganThirumalai murugan

          3,45562551




          3,45562551













          • @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as this answer has stated actually fixed it for me

            – Temitayo
            Oct 28 '14 at 7:38











          • @Temitayo have you tried my answer?

            – Thirumalai murugan
            Oct 28 '14 at 8:51











          • Iused @Vikas answer but I used a fragment from yours i.e. using 465 as emtp_port. Good work anyway

            – Temitayo
            Nov 1 '14 at 22:35











          • Fatal error: Class 'PHPMailer' not found in C:xampphtdocsmywebemail_script.php on line 82

            – Shafizadeh
            Feb 13 '16 at 16:17











          • you have to download the phpmailer github.com/Synchro/PHPMailer

            – Thirumalai murugan
            Feb 16 '16 at 6:10





















          • @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as this answer has stated actually fixed it for me

            – Temitayo
            Oct 28 '14 at 7:38











          • @Temitayo have you tried my answer?

            – Thirumalai murugan
            Oct 28 '14 at 8:51











          • Iused @Vikas answer but I used a fragment from yours i.e. using 465 as emtp_port. Good work anyway

            – Temitayo
            Nov 1 '14 at 22:35











          • Fatal error: Class 'PHPMailer' not found in C:xampphtdocsmywebemail_script.php on line 82

            – Shafizadeh
            Feb 13 '16 at 16:17











          • you have to download the phpmailer github.com/Synchro/PHPMailer

            – Thirumalai murugan
            Feb 16 '16 at 6:10



















          @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as this answer has stated actually fixed it for me

          – Temitayo
          Oct 28 '14 at 7:38





          @Vikas answer was best, but please note that using the default ssl on smtp_port might not work in certain condition, using 465 as this answer has stated actually fixed it for me

          – Temitayo
          Oct 28 '14 at 7:38













          @Temitayo have you tried my answer?

          – Thirumalai murugan
          Oct 28 '14 at 8:51





          @Temitayo have you tried my answer?

          – Thirumalai murugan
          Oct 28 '14 at 8:51













          Iused @Vikas answer but I used a fragment from yours i.e. using 465 as emtp_port. Good work anyway

          – Temitayo
          Nov 1 '14 at 22:35





          Iused @Vikas answer but I used a fragment from yours i.e. using 465 as emtp_port. Good work anyway

          – Temitayo
          Nov 1 '14 at 22:35













          Fatal error: Class 'PHPMailer' not found in C:xampphtdocsmywebemail_script.php on line 82

          – Shafizadeh
          Feb 13 '16 at 16:17





          Fatal error: Class 'PHPMailer' not found in C:xampphtdocsmywebemail_script.php on line 82

          – Shafizadeh
          Feb 13 '16 at 16:17













          you have to download the phpmailer github.com/Synchro/PHPMailer

          – Thirumalai murugan
          Feb 16 '16 at 6:10







          you have to download the phpmailer github.com/Synchro/PHPMailer

          – Thirumalai murugan
          Feb 16 '16 at 6:10













          12














          You can test send mail in Your PC without Internet



          you should use Papercut this simple application to test send mail. and you don't need to configure anything.



          Just run it and try test send mail:



          test_sendmail.php



          <?php
          $to = "somebody@example.com";
          $subject = "My subject";
          $txt = "Hello world!";
          $headers = "From: webmaster@example.com" . "rn" .
          "CC: somebodyelse@example.com";

          mail($to,$subject,$txt,$headers);
          ?>


          and you will see this:



          enter image description here



          I hope you will have a good day.
          you can find me on Youtube for more tutorial Piseth Sok



          Cheer!






          share|improve this answer




























            12














            You can test send mail in Your PC without Internet



            you should use Papercut this simple application to test send mail. and you don't need to configure anything.



            Just run it and try test send mail:



            test_sendmail.php



            <?php
            $to = "somebody@example.com";
            $subject = "My subject";
            $txt = "Hello world!";
            $headers = "From: webmaster@example.com" . "rn" .
            "CC: somebodyelse@example.com";

            mail($to,$subject,$txt,$headers);
            ?>


            and you will see this:



            enter image description here



            I hope you will have a good day.
            you can find me on Youtube for more tutorial Piseth Sok



            Cheer!






            share|improve this answer


























              12












              12








              12







              You can test send mail in Your PC without Internet



              you should use Papercut this simple application to test send mail. and you don't need to configure anything.



              Just run it and try test send mail:



              test_sendmail.php



              <?php
              $to = "somebody@example.com";
              $subject = "My subject";
              $txt = "Hello world!";
              $headers = "From: webmaster@example.com" . "rn" .
              "CC: somebodyelse@example.com";

              mail($to,$subject,$txt,$headers);
              ?>


              and you will see this:



              enter image description here



              I hope you will have a good day.
              you can find me on Youtube for more tutorial Piseth Sok



              Cheer!






              share|improve this answer













              You can test send mail in Your PC without Internet



              you should use Papercut this simple application to test send mail. and you don't need to configure anything.



              Just run it and try test send mail:



              test_sendmail.php



              <?php
              $to = "somebody@example.com";
              $subject = "My subject";
              $txt = "Hello world!";
              $headers = "From: webmaster@example.com" . "rn" .
              "CC: somebodyelse@example.com";

              mail($to,$subject,$txt,$headers);
              ?>


              and you will see this:



              enter image description here



              I hope you will have a good day.
              you can find me on Youtube for more tutorial Piseth Sok



              Cheer!







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 8 '17 at 3:38









              Piseth SokPiseth Sok

              9731918




              9731918























                  5














                  For people on windows 8 if you want to do this i would really recommend reading this tutorial i found: http://yogeshchaugule.com/blog/2013/configure-sendmail-wamp



                  Its not written by me but after slamming my head into a concrete wall for 2,5 hours not getting this to work with the weirdest errors like:




                  • Connection timed out.

                  • Connection Closed Gracefully.


                  I finally found that tutorial were upon installation of https://www.stunnel.org/downloads.html and the configuration of Stunnel. It finally worked.






                  share|improve this answer
























                  • I had the exact same issue (Connection Closed Gracefully) and I was able to fix it by installing stunnel by following the steps mentioned here: digiex.net/guides-reviews/guides-tutorials/application-guides/… with a very slight change, I had to comment the output, debug and socket parameters from stunnel.conf as they were throwing an error. Upvoted.

                    – Special K.
                    Jun 23 '14 at 18:46
















                  5














                  For people on windows 8 if you want to do this i would really recommend reading this tutorial i found: http://yogeshchaugule.com/blog/2013/configure-sendmail-wamp



                  Its not written by me but after slamming my head into a concrete wall for 2,5 hours not getting this to work with the weirdest errors like:




                  • Connection timed out.

                  • Connection Closed Gracefully.


                  I finally found that tutorial were upon installation of https://www.stunnel.org/downloads.html and the configuration of Stunnel. It finally worked.






                  share|improve this answer
























                  • I had the exact same issue (Connection Closed Gracefully) and I was able to fix it by installing stunnel by following the steps mentioned here: digiex.net/guides-reviews/guides-tutorials/application-guides/… with a very slight change, I had to comment the output, debug and socket parameters from stunnel.conf as they were throwing an error. Upvoted.

                    – Special K.
                    Jun 23 '14 at 18:46














                  5












                  5








                  5







                  For people on windows 8 if you want to do this i would really recommend reading this tutorial i found: http://yogeshchaugule.com/blog/2013/configure-sendmail-wamp



                  Its not written by me but after slamming my head into a concrete wall for 2,5 hours not getting this to work with the weirdest errors like:




                  • Connection timed out.

                  • Connection Closed Gracefully.


                  I finally found that tutorial were upon installation of https://www.stunnel.org/downloads.html and the configuration of Stunnel. It finally worked.






                  share|improve this answer













                  For people on windows 8 if you want to do this i would really recommend reading this tutorial i found: http://yogeshchaugule.com/blog/2013/configure-sendmail-wamp



                  Its not written by me but after slamming my head into a concrete wall for 2,5 hours not getting this to work with the weirdest errors like:




                  • Connection timed out.

                  • Connection Closed Gracefully.


                  I finally found that tutorial were upon installation of https://www.stunnel.org/downloads.html and the configuration of Stunnel. It finally worked.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 5 '14 at 13:01









                  N.SchipperN.Schipper

                  1,04331423




                  1,04331423













                  • I had the exact same issue (Connection Closed Gracefully) and I was able to fix it by installing stunnel by following the steps mentioned here: digiex.net/guides-reviews/guides-tutorials/application-guides/… with a very slight change, I had to comment the output, debug and socket parameters from stunnel.conf as they were throwing an error. Upvoted.

                    – Special K.
                    Jun 23 '14 at 18:46



















                  • I had the exact same issue (Connection Closed Gracefully) and I was able to fix it by installing stunnel by following the steps mentioned here: digiex.net/guides-reviews/guides-tutorials/application-guides/… with a very slight change, I had to comment the output, debug and socket parameters from stunnel.conf as they were throwing an error. Upvoted.

                    – Special K.
                    Jun 23 '14 at 18:46

















                  I had the exact same issue (Connection Closed Gracefully) and I was able to fix it by installing stunnel by following the steps mentioned here: digiex.net/guides-reviews/guides-tutorials/application-guides/… with a very slight change, I had to comment the output, debug and socket parameters from stunnel.conf as they were throwing an error. Upvoted.

                  – Special K.
                  Jun 23 '14 at 18:46





                  I had the exact same issue (Connection Closed Gracefully) and I was able to fix it by installing stunnel by following the steps mentioned here: digiex.net/guides-reviews/guides-tutorials/application-guides/… with a very slight change, I had to comment the output, debug and socket parameters from stunnel.conf as they were throwing an error. Upvoted.

                  – Special K.
                  Jun 23 '14 at 18:46











                  1














                  If you have an installed copy of xampp latest copy then check this link for complete documentation of sending emails through xampp. You must enable apache before you try to access the below link



                  http://localhost/dashboard/docs/send-mail.html






                  share|improve this answer




























                    1














                    If you have an installed copy of xampp latest copy then check this link for complete documentation of sending emails through xampp. You must enable apache before you try to access the below link



                    http://localhost/dashboard/docs/send-mail.html






                    share|improve this answer


























                      1












                      1








                      1







                      If you have an installed copy of xampp latest copy then check this link for complete documentation of sending emails through xampp. You must enable apache before you try to access the below link



                      http://localhost/dashboard/docs/send-mail.html






                      share|improve this answer













                      If you have an installed copy of xampp latest copy then check this link for complete documentation of sending emails through xampp. You must enable apache before you try to access the below link



                      http://localhost/dashboard/docs/send-mail.html







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Aug 25 '18 at 10:59









                      Jignesh RawalJignesh Rawal

                      337312




                      337312























                          0














                          You have to define an SMTP server and a port for this. All except like sending mails from live hosts.



                          This is a useful link regarding this.




                          NB: The port should be unused. Please take care that, Some
                          applications like Skype uses the default ports and there by prevents
                          sending mail.







                          share|improve this answer
























                          • You can prevent skype from using port 80. its on connection settings of skype

                            – astroanu
                            Jan 27 '15 at 3:54
















                          0














                          You have to define an SMTP server and a port for this. All except like sending mails from live hosts.



                          This is a useful link regarding this.




                          NB: The port should be unused. Please take care that, Some
                          applications like Skype uses the default ports and there by prevents
                          sending mail.







                          share|improve this answer
























                          • You can prevent skype from using port 80. its on connection settings of skype

                            – astroanu
                            Jan 27 '15 at 3:54














                          0












                          0








                          0







                          You have to define an SMTP server and a port for this. All except like sending mails from live hosts.



                          This is a useful link regarding this.




                          NB: The port should be unused. Please take care that, Some
                          applications like Skype uses the default ports and there by prevents
                          sending mail.







                          share|improve this answer













                          You have to define an SMTP server and a port for this. All except like sending mails from live hosts.



                          This is a useful link regarding this.




                          NB: The port should be unused. Please take care that, Some
                          applications like Skype uses the default ports and there by prevents
                          sending mail.








                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Apr 12 '13 at 7:25









                          Vishnu RenkuVishnu Renku

                          1,54021942




                          1,54021942













                          • You can prevent skype from using port 80. its on connection settings of skype

                            – astroanu
                            Jan 27 '15 at 3:54



















                          • You can prevent skype from using port 80. its on connection settings of skype

                            – astroanu
                            Jan 27 '15 at 3:54

















                          You can prevent skype from using port 80. its on connection settings of skype

                          – astroanu
                          Jan 27 '15 at 3:54





                          You can prevent skype from using port 80. its on connection settings of skype

                          – astroanu
                          Jan 27 '15 at 3:54











                          0














                          just spent over an hour trying to make this work. for everybody having the same trouble with all the suggestions posted not working: you have to restart Apache in your XAMPP inrerface! just restarting XAMPP wont work!!






                          share|improve this answer




























                            0














                            just spent over an hour trying to make this work. for everybody having the same trouble with all the suggestions posted not working: you have to restart Apache in your XAMPP inrerface! just restarting XAMPP wont work!!






                            share|improve this answer


























                              0












                              0








                              0







                              just spent over an hour trying to make this work. for everybody having the same trouble with all the suggestions posted not working: you have to restart Apache in your XAMPP inrerface! just restarting XAMPP wont work!!






                              share|improve this answer













                              just spent over an hour trying to make this work. for everybody having the same trouble with all the suggestions posted not working: you have to restart Apache in your XAMPP inrerface! just restarting XAMPP wont work!!







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jan 2 '14 at 13:46









                              user3065579user3065579

                              105




                              105























                                  0














                                  As in my personal experience I found that very similar thing to Vikas Dwivedi answer will work just fine.



                                  Step 1 (php.ini file)




                                  In php.ini file located in xamppphpphp.ini. Change settings to the following:



                                  extension=php_openssl.dll
                                  [mail function]
                                  sendmail_path =":xampp7sendmailsendmail.exe -t"
                                  mail.add_x_header=On


                                  Turn off other variables under mail funciton by putting ; before them. e.g ;smtp_port=25




                                  Step 2 (sendmail.ini file)




                                  In sendmail.ini located in xamppsendmailsemdmail.ini change to the
                                  following:



                                  smtp_server=smtp.gmail.com
                                  smtp_port=465
                                  smtp_ssl=auto
                                  auth_username=address@gmail.com
                                  auth_password=YourPassword



                                  Step 3 (code)




                                  Create a php file and use the following:



                                  <?php
                                  mail($to, "subject", "body", "From: ".$from);
                                  ?>



                                  Notice




                                  • You need to restart apache in order for php.ini to reload.

                                  • you need to activate Google Less secure app access in https://myaccount.google.com/u/1/security

                                  • It might help to run Xampp with Admin permission.






                                  share|improve this answer






























                                    0














                                    As in my personal experience I found that very similar thing to Vikas Dwivedi answer will work just fine.



                                    Step 1 (php.ini file)




                                    In php.ini file located in xamppphpphp.ini. Change settings to the following:



                                    extension=php_openssl.dll
                                    [mail function]
                                    sendmail_path =":xampp7sendmailsendmail.exe -t"
                                    mail.add_x_header=On


                                    Turn off other variables under mail funciton by putting ; before them. e.g ;smtp_port=25




                                    Step 2 (sendmail.ini file)




                                    In sendmail.ini located in xamppsendmailsemdmail.ini change to the
                                    following:



                                    smtp_server=smtp.gmail.com
                                    smtp_port=465
                                    smtp_ssl=auto
                                    auth_username=address@gmail.com
                                    auth_password=YourPassword



                                    Step 3 (code)




                                    Create a php file and use the following:



                                    <?php
                                    mail($to, "subject", "body", "From: ".$from);
                                    ?>



                                    Notice




                                    • You need to restart apache in order for php.ini to reload.

                                    • you need to activate Google Less secure app access in https://myaccount.google.com/u/1/security

                                    • It might help to run Xampp with Admin permission.






                                    share|improve this answer




























                                      0












                                      0








                                      0







                                      As in my personal experience I found that very similar thing to Vikas Dwivedi answer will work just fine.



                                      Step 1 (php.ini file)




                                      In php.ini file located in xamppphpphp.ini. Change settings to the following:



                                      extension=php_openssl.dll
                                      [mail function]
                                      sendmail_path =":xampp7sendmailsendmail.exe -t"
                                      mail.add_x_header=On


                                      Turn off other variables under mail funciton by putting ; before them. e.g ;smtp_port=25




                                      Step 2 (sendmail.ini file)




                                      In sendmail.ini located in xamppsendmailsemdmail.ini change to the
                                      following:



                                      smtp_server=smtp.gmail.com
                                      smtp_port=465
                                      smtp_ssl=auto
                                      auth_username=address@gmail.com
                                      auth_password=YourPassword



                                      Step 3 (code)




                                      Create a php file and use the following:



                                      <?php
                                      mail($to, "subject", "body", "From: ".$from);
                                      ?>



                                      Notice




                                      • You need to restart apache in order for php.ini to reload.

                                      • you need to activate Google Less secure app access in https://myaccount.google.com/u/1/security

                                      • It might help to run Xampp with Admin permission.






                                      share|improve this answer















                                      As in my personal experience I found that very similar thing to Vikas Dwivedi answer will work just fine.



                                      Step 1 (php.ini file)




                                      In php.ini file located in xamppphpphp.ini. Change settings to the following:



                                      extension=php_openssl.dll
                                      [mail function]
                                      sendmail_path =":xampp7sendmailsendmail.exe -t"
                                      mail.add_x_header=On


                                      Turn off other variables under mail funciton by putting ; before them. e.g ;smtp_port=25




                                      Step 2 (sendmail.ini file)




                                      In sendmail.ini located in xamppsendmailsemdmail.ini change to the
                                      following:



                                      smtp_server=smtp.gmail.com
                                      smtp_port=465
                                      smtp_ssl=auto
                                      auth_username=address@gmail.com
                                      auth_password=YourPassword



                                      Step 3 (code)




                                      Create a php file and use the following:



                                      <?php
                                      mail($to, "subject", "body", "From: ".$from);
                                      ?>



                                      Notice




                                      • You need to restart apache in order for php.ini to reload.

                                      • you need to activate Google Less secure app access in https://myaccount.google.com/u/1/security

                                      • It might help to run Xampp with Admin permission.







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 17 hours ago

























                                      answered 17 hours ago









                                      Mahdi RafatjahMahdi Rafatjah

                                      535317




                                      535317

















                                          protected by Community Jan 11 '15 at 9:06



                                          Thank you for your interest in this question.
                                          Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                          Would you like to answer one of these unanswered questions instead?



                                          Popular posts from this blog

                                          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                                          ComboBox Display Member on multiple fields

                                          Is it possible to collect Nectar points via Trainline?