How to configure XAMPP to send mail from localhost?

后端 未结 11 2745
梦如初夏
梦如初夏 2020-11-21 05:17

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

11条回答
  •  萌比男神i
    2020-11-21 05:50

    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 xampp\php\php.ini. Change settings to the following:

     extension=php_openssl.dll
     [mail function]
     sendmail_path =":\xampp7\sendmail\sendmail.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 xampp\sendmail\semdmail.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:

     
    

    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.

提交回复
热议问题