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:
- First check if sendmail (actually Postfix) is installed. I am using Ubuntu 11.x.
cd usr/sbin/
- If you can't find sendmail, then it needs to be installed
sudo apt-get install postfix
- I accepted the default options on the dialogs and once install was complete, emails sent without a problem.
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..