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

[eluser]Genki1[/eluser]
Issue: Cannot send emails via CI.

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

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

Details:

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.

Examples:

1. Sending a message with a long subject like this, the email is not sent:
Code:
$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:

Code:
?utf-8?Q?New_member_registered_at_KRC_Group's_"Name_the_Company"_contes?=?utf-8?Q?t?

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:
Code:
$this->email->subject('New member at KRC Group's "Name the Company" contest');
The text which CI passes to PHP mail() is:
Code:
?utf-8?Q?New_member_at_KRC_Group's_"Name_the_Company"_contest?=

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.
#2

[eluser]Zocee[/eluser]
I’m having a weird problem here please see the following link:

http://ellislab.com/forums/viewthread/163620/
#3

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