Send email from localhost running XAMMP in PHP using GMAIL mail server
Here's the link that gives me the answer:
[Install] the "fake sendmail for windows". If you are not using XAMPP you can download it here: http://glob.com.au/sendmail/sendmail.zip
[Modify] the php.ini file to use it (commented out the other lines):
[mail function]
; For Win32 only.
; SMTP = smtp.gmail.com
; smtp_port = 25
; For Win32 only.
; sendmail_from = <e-mail username>@gmail.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
(ignore the "Unix only" bit, since we actually are using sendmail)
You then have to configure the "sendmail.ini" file in the directory where sendmail was installed:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=<username>
auth_password=<password>
force_sender=<e-mail username>@gmail.com
To access a Gmail account protected by 2-factor verification, you will need to create an application-specific password. (source)
How to send email in php in xampp?
There was a mistake in my path
sendmail_path = "\"D:xampp\sendmail\sendmail.exe\" -t"
should be
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"
Sending email from localhost server xampp/sendmail
Try this
sendmail.ini
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=ssl
error_logfile=error.log
debug_logfile=debug.log
auth_username=[email]@gmail.com
auth_password=[email password]
pop3_server=
pop3_username=
pop3_password=
force_sender=[email]@gmail.com
force_recipient=
hostname=smtp.gmail.com
php.ini
[mail function]
SMTP = smtp.gmail.com
smtp_port = 465
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header=Off
Related Topics
Accessing @Attribute from Simplexml
Check If PHP Session Has Already Started
Open_Basedir Restriction in Effect. File(/) Is Not Within the Allowed Path(S):
Matching Unicode Letter Characters in Pcre/PHP
How to Make Asynchronous Http Requests in PHP
How to Maintain a "Version For the Server" - With Only Config Files Changed, in Git
Sort Array of Objects by One Property
How to Retrieve Images from MySQL Database and Display in an HTML Tag
Detect Encoding and Make Everything Utf-8
PHP Pass by Reference in Foreach
How to Access PHP Variables in JavaScript or Jquery Rather Than ≪PHP Echo $Variable ≫
Calling Closure Assigned to Object Property Directly
How to Mathematically Evaluate a String Like "2-1" to Produce "1"
Make All Words Lowercase and the First Letter of Each Word Uppercase