I built an intranet app that needs to send email (low volume). I will not be able to use the SMTP server of my organization, so I need to send these emails via sendmail
or mail
.
However, when I config my email as:
$config['protocol'] = 'sendmail';
I get:
Exit status code: 127
Unable to open a socket to Sendmail. Please check settings.
Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.
and when I use:
$config['protocol'] = 'mail';
I get:
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
Is there anything I should setup in PHP or check in phpinfo()
to figure out how to get this to work?
OK - this was simple.
For anyone who faces this issue:
cd usr/sbin/
sudo apt-get install postfix
In windows os , i have tried sendmail class.
You have to put sendmail.exe,sendmail.ini, and other two .dll files inside,
C:\\wamp\\sendmail
configure sendmail.ini file as follow for gmail server :
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=tls
error_logfile=error.log
debug_logfile=debug.log
auth_username=mymail@gmail.com
auth_password=mypassword
hostname=smtp.gmail.com
then edit your php.ini file, that is available inside
C:\\wamp\\bin\\apache\\Apache2.2.17\\bin
sendmail_path="C:\wamp\sendmail\sendmail.exe -t -i"
Now run your project, see log files at:
C:\\wamp\\sendmail\\error.log C:\\wamp\\sendmail\\debug.log
i think this post can help you..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.