Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iqbalrony/6dec46003d7f215124bb067e5110f2a3 to your computer and use it in GitHub Desktop.
Save iqbalrony/6dec46003d7f215124bb067e5110f2a3 to your computer and use it in GitHub Desktop.
You can setup SMTP mail server on xampp local server.
----------------------------------------------------------------------------------
This is only for windows operator.
You have to edit two file on xampp folder to setup SMTP mail on local server
and some setup on your gmail account.There are 3 steps which are:-
1. php.ini file from this folder location ==> C:\xampp\php\php.ini
2. sendmail.ini file from this flder location ==> C:\xampp\sendmail\sendmail.ini
3. Go to this link https://support.google.com/accounts/answer/6010255
----------------------------------------------------------------------------------
/**
* 1st step....
* Open php.ini file from the instructed path.
* Go to line 1041 and replace from 1041 to 1062 line by bellow code
* OR
* Search by this kye word [mail function] and replace from [mail function] to mail.add_x_header=On by bellow code
* replace your-gmail@gmail.com by your gmail mail (you must use gmail from where maill will be sent).
*/
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP=localhost
; http://php.net/smtp-port
smtp_port=587
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = your-gmail@gmail.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=On
/**
* 2nd step....
* Open sendmail.ini file from the instructed path.
* Go to line 14 or serche this key word smtp_server and replace smtp.gmail.com by your gmail.
* Go to line 18 or serche this key word smtp_port and replace 25 by 587.
* Go to line 46 or serche this key word auth_username and set your gmail mail address.
* Go to line 47 or serche this key word auth_password and set your gmail mail password.
* Go to line 60 or serche this key word force_sender and set your gmail mail address.
*/
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=your-gmail@gmail.com
auth_password=your-gmail-password
force_sender=your-gmail@gmail.com
/**
* 3rd step....
* Go to https://support.google.com/accounts/answer/6010255
* Change account access for less secure apps
* Go to your Google Account
* On the left navigation panel, click Security.
* On the bottom of the page, in the Less secure app access panel, click Turn on access.
*/
=====> https://support.google.com/accounts/answer/6010255
//Everything is done and restert Apache and enjoy sending mail from local server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment