Welcome Guest, Not a member yet? Register   Sign In
Tip to avoid email send error: shorten Subject

Issue: Cannot send emails via CI.

Symptom: PHP reports 'function.email(): bad parameters'

Solution: Shorten the string length of the email "Subject"
$this->email->subject('your short subject goes here');


CI 1.7.2 system library "Email.php" processes the Subject [See: function subject() (Line 347) and function _prep_q_encoding() (Line 1262)]. After CI processes a long Subject to meet the requirements of RFC 2047 (encoded words must not exceed 76 characters, including characters used for encoding), PHP mail() on my GoDaddy server fails to send the email.


1. Sending a message with a long subject like this, the email is not sent:
$this->email->subject('New member registered at KRC Group's "Name the Company" contest');
When CI processes this Subject, the resulting text which CI passes to PHP mail() is:


Notice above that the final "t" in the word "contest" was moved to the next segment.

2. After shortening the Subject string, as below, the email is sent successfully:
$this->email->subject('New member at KRC Group's "Name the Company" contest');
The text which CI passes to PHP mail() is:

See also: PHP documentation for mail() [php.net/manual/en/function.mail.php] says that the "Subject must satisfy RFC 2047."

I hope these observations help others to save time and effort.

I’m having a weird problem here please see the following link:


What is the solution to this? Do I have to keep all my subject lines under 50 characters?

Theme © iAndrew 2016 - Forum software by © MyBB