Welcome Guest, Not a member yet? Register   Sign In
SMTP Email not working
#1

[eluser]The Mask[/eluser]
Hi, I'm having some problems trying to get my email working on a new Windows7 PC.

In my test controller, I have...

$this->load->library('email');
$this->email->clear();
ini_set( 'SMTP', 'smtp.ntlworld.com' );
ini_set( 'smtp_port', 465 );

$config[ 'newline' ] = '\r\n';
$config[ 'crlf' ] = '\r\n';
$config[ 'protocol' ] = 'smtp';
$config[ 'smtp_host' ] = 'smtp.ntlworld.com';
$config[ 'smtp_port' ] = '465';
$config[ 'smtp_user' ] = '[email protected]';
$config[ 'smtp_pass' ] = 'mypassword';
$config[ 'mailtype' ] = 'html';

$this->email->initialize( $config );

$this->email->from('[email protected]', 'My Site');
$this->email->to('[email protected]');

$this->email->subject('Email Test');
$this->email->message('Testing the email class.');

$this->email->send();

The error I get is...
Fatal error: Maximum execution time of 30 seconds exceeded in C:\server\webroot\System\libraries\Email.php on line 1818

Previous threads have suggested adding
$config[ 'newline' ] = '\r\n';
$config[ 'crlf' ] = '\r\n';
which I have but it makes no difference.

Any ideas please?
#2

[eluser]InsiteFX[/eluser]
Try using this:
Code:
$this->email->print_debugger()

InsiteFX
#3

[eluser]The Mask[/eluser]
Yep, tried that but I don't think it's getting as far as that in the code as it never reports anything. The line that is giving the error is FGETS() in Email.php!!
#4

[eluser]moodsey211[/eluser]
Try doing it manually so you could isolate the problem. or you could echo the string read by fgets so we would know what it is trying to read.
#5

[eluser]HA[/eluser]
Did you happen to find a solution for this problem? I'm running into the same issue...

Thanks!
#6

[eluser]The Mask[/eluser]
Nope. Still got the problem.
#7

[eluser]HA[/eluser]
Hehe, well let me give you a bit of assistance then Wink

The solution seems to be to declare the config parameters as an array, then load the email library with the config passed as an argument. Additionally, lots of people seem to think that then manually setting the newline character also helps. Here's an example:

Code:
$config = Array(
   'protocol'  => 'smtp',
   'smtp_host' => 'xxx',
   'smtp_port' => 25,
   'mailtype'  => 'html',
   'charset'   => 'iso-8859-1'
);

$this->load->library('email', $config);

$this->email->set_newline("\r\n");

$this->email->from('[email protected]');
$this->email->to('[email protected]');
$this->email->subject($email_subject);
$this->email->message($email_message);

$this->email->send();

It worked for me with an IIS server and Exchange SMTP, so God willing, it should help!




Theme © iAndrew 2016 - Forum software by © MyBB