Welcome Guest, Not a member yet? Register   Sign In
I choose SMTP, but get mail() error
#11

[eluser]nunomira[/eluser]
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.
#12

[eluser]novice32[/eluser]
Yeah.. weird. I have another post with another email error (mailtype): http://ellislab.com/forums/viewthread/151416/
#13

[eluser]Jondolar[/eluser]
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.
#14

[eluser]novice32[/eluser]
If it were being blocked by a firewall, why would adding
Code:
ini_set('SMTP', 'smtp.comcast.net');
make it work?
#15

[eluser]Buso[/eluser]
I had the same problem, solved it by setting:

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

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

[eluser]InsiteFX[/eluser]
Here is a nicee little utility for Windows for testing smtp etc.

Test Mail Server Tool

InsiteFX
#17

[eluser]novice32[/eluser]
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.
#18

[eluser]Tominator[/eluser]
I am using PHPMailer (i rewrited it to CI) and all problems are gone Smile
#19

[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]
#20

[eluser]nunomira[/eluser]
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:

email.php:
Code:
$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";
and

email_notification.php
Code:
$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:
Code:
private function send_notification_email($to_email, $to_name)
{
  $this->load->library('email');
  $this->config->load('email_notification');

  $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);

  $this->email->subject($subject);
  $this->email->message($message);

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

  return $sent;
}




Theme © iAndrew 2016 - Forum software by © MyBB