Send Email from Localhost Running Xammp in PHP Using Gmail Mail Server

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



Leave a reply



Submit