Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending email with CodeIgniter using 'mail' or 'sendmail'

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?

like image 304
pepe Avatar asked Mar 15 '26 02:03

pepe


1 Answers

OK - this was simple.

For anyone who faces this issue:

  1. First check if sendmail (actually Postfix) is installed. I am using Ubuntu 11.x.

cd usr/sbin/

  1. If you can't find sendmail, then it needs to be installed
sudo apt-get install postfix
  1. I accepted the default options on the dialogs and once install was complete, emails sent without a problem.
like image 122
pepe Avatar answered Mar 17 '26 16:03

pepe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!