3

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?

pepe
  • 9,145
  • 24
  • 100
  • 177
  • 1
    Have you tried simply not configuring anything? This works most times. If that doesn't work, then I'm guessing the problem is in the `$config['mailpath']` variable. – Robert Jul 25 '12 at 15:21
  • do a google search with `codeigniter email settings site:stackoverflow.com` and see if any of the existing questions/answers help you. – Kinjal Dixit Jul 25 '12 at 15:23
  • I've been searching for a solution but nothing is specific so far - I need only to SEND email, and everything I find suggests building an email server that can send and receive – pepe Jul 25 '12 at 15:26

2 Answers2

10

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.
pepe
  • 9,145
  • 24
  • 100
  • 177
1

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..