How can I Setup XAMPP for SMTP outgoing Email on a UNIX machine
First install a sendmail
sudo apt-get install sendmail
In the php.ini
file find [mail function]
and change it as follows:
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from=your@gmail.com
sendmail_path=/usr/sbin/sendmail -t -i
Windows
Now edit the `sendmail.ini`:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=username@gmail.com
auth_password=gmail-password
force_sender=username@gmail.comLinux
Once you have installed
sendmail
you can run following command:sudo sendmailconfig
. Answer[Y]
to all questions.Make new directory:
sudo mkdir -m 700 /etc/mail/authinfo && cd /etc/mail/authinfo
Create new file:
sudo touch ./gmail-auth
Insert following content:
AuthInfo: "U:YOUR ACCOUNT NAME" "I:YOUR GMAIL EMAIL ADDRESS" "P:YOUR GMAIL PASSWORD"
Create new hash map:
makemap hash gmail-auth < gmail-auth
Open
/etc/mail/sendmail.mc
and above first MAILER definition add:define(`SMART_HOST',`[smtp.gmail.com]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/authinfo/gmail-auth')dnlRebuild configuration and restart sendmail service
sudo make -C /etc/mail && sudo service sendmail restart
macOS
Install homebrew and
sendmail
withbrew install sendmail
In order to get the installation dir execute following command:brew info sendmail
. Do the same configuration steps from the Linux part of this answer.
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
How to Increase Maximum Execution Time in Laravel
Convert HTML Form Data into a Pdf File Using PHP
Converting Timestamp to Time Ago in PHP E.G 1 Day Ago, 2 Days Ago...
Call to Undefined Method MySQLi_Stmt::Get_Result
PHP, Curl, and Http Post Example
Implode a Column of Values from a Two Dimensional Array
How to Get Woocommerce Order Details
How to Flatten a Multidimensional Array
Are Pdo Prepared Statements Sufficient to Prevent SQL Injection
Get All Hrefs from String But Then Replace Via Another Method
Openssl Ssl_Read: Ssl_Error_Syscall, Errno 104
Warning: Preg_Replace(): Unknown Modifier
PHP Multidimensional Array Search by Value
How to Create Multi Level Category Hierarchy ( Category Tree ) - Codeigniter
SQL Injection That Gets Around mysql_real_escape_string()
Symfony: an Exception Occured in Driver: Could Not Find Driver With MySQL