Getting PHP error/warnings when using CodeIgniter 2 to send email

Posted by Sparky672 on Stack Overflow See other posts from Stack Overflow or by Sparky672
Published on 2012-12-05T22:06:38Z Indexed on 2012/12/05 23:04 UTC
Read the original article Hit count: 464

Filed under:
|
|
|

I'm using Ion Auth and trying to implement the forgotten password feature which relies upon an email being sent from CI. My LAMP server is on a shared cPanel account and uses sendmail. However, I have the ability to over-ride any PHP settings with my own php.ini file in the public_html directory.

As per the CodeIgniter 2 documentation for configuring email sending, I have done the following...

1) created a file called located at application/config/email.php

2) email.php contains this code:

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| EMAIL SENDING SETTINGS
| -------------------------------------------------------------------
*/

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

/* End of file email.php */
/* Location: ./application/config/email.php */

3) The in the application/config/ion_auth.php file, I set this value to TRUE

$config['use_ci_email'] = TRUE;

The email is successfully sent, but I get a variety of PHP Error Warnings on all pages.

These appear on all pages, sometimes two or three times in a row:

A PHP Error was encountered

Severity: Warning

Message: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead

Filename: libraries/Email.php

Line Number: 704

A PHP Error was encountered

Severity: Warning

Message: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead

Filename: libraries/Email.php

Line Number: 709

In addition to the above, these two also show up after the forgotten password form is submitted:

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/username/codeigniter/system/core/Exceptions.php:185)

Filename: libraries/Session.php

Line Number: 675

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/username/codeigniter/system/core/Exceptions.php:185)

Filename: helpers/url_helper.php

Line Number: 540

I'm not sure why I would be getting these Error Warnings or how else I am supposed to configure my email sending options. I don't see any other email sending options in the documentation that is related to these particular Warning Messages. When I remove my config/email.php file AND set Ion Auth's use_ci_email to FALSE, the Error Warnings go away.

Where did I go wrong?


Just before I hit the submit button, I solved this problem. I'm still going to post this question as a learning experience for others. If nobody solves this after a reasonable amount of time, I'll post the solution.

© Stack Overflow or respective owner

Related posts about php

Related posts about codeigniter-2