I choose SMTP, but get mail() error

I was never able to solve or understand it...
Even this week I had the same problem again.
When testing locally I get the error... when testing online it works as expected.
The strange this is that it used to work locally.

Yeah.. weird. I have another post with another email error (mailtype): http://ellislab.com/forums/viewthread/151416/

You might want to check to see if you are being blocked by a firewall, either at the remote server end or on your web server.

If it were being blocked by a firewall, why would adding
ini_set('SMTP', 'smtp.comcast.net');
make it work?

I had the same problem, solved it by setting:

$config['protocol'] = 'sendmail';

I don't even know what's the difference, but it worked for me =P (in a linux shared server @ godaddy)

Here is a nicee little utility for Windows for testing smtp etc.

Test Mail Server Tool


The Test Mail Server tool is awesome!! Thanks for the tip. Now I can use it to test locally and feel confident about pushing email content updates to production.

I am using PHPMailer (i rewrited it to CI) and all problems are gone Smile

[eluser]Jin Nguyen[/eluser]
[quote author="Tominator" date="1271546899"]I am using PHPMailer (i rewrited it to CI) and all problems are gone Smile[/quote]
Can you help me config?
Can you send me your code?
i try but i can do it.
i hope you can help me !
my gmail: [email protected]

After almost 3 years I got some problems with sending emails, and I have learnt some valuable lessons.

Maybe this was the problem at the time, but the config file used for email has to be called email.php (this is explained in the docs).
Maybe I was using something like email_notification.php. This doesn't work, as it $this->email will never get the desired configuration.

So, I'd need two config files:

$config['protocol'] = 'smtp';

$config['smtp_host'] = 'mail.myDomain.com';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'myDomain';

$config['port'] = 25;
$config['newline'] = "\r\n";

$config['email_from'] = '[email protected]';
$config['email_from_name'] = 'sender';

email.php gets loaded automatically and email_notification.php is loaded with $this->config->load('email_notification');.

Here's an example of a code in a controller:
private function send_notification_email($to_email, $to_name)

  $subject = $this->config->item('email_subject');
  $message = '';
  $message .= "Hi $to_name,\n\n";
  $message .= "Here goes the message!\n\n";
  $message .= "Bye\n\n";

  $this->email->from($this->config->item('email_from'), $this->config->item('email_from_name'));
  $this->email->to($to_email, $to_name);


  $sent = $this->email->send();

  return $sent;

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.