Email issue - Q prep for header |
[eluser]FranckRR[/eluser]
Using utf-8 / html format with the Email library, a space is added on the subject $this->CI->load->library('email'); $this->CI->email->set_mailtype("html"); $this->CI->email->from($fromAddress, $fromName); $this->CI->email->to($toAddress); $this->CI->email->reply_to($replyToAddress, $replyToName); //Envoi d'un header supplémentaire avec le nom //$this->CI->email->subject($subject); //Bug add space un the subject !!! $this->CI->email->_headers['Subject']= $subject; //I had to do this UGLY thing !!! $this->CI->email->message($bodyHTML); $result=$this->CI->email->send($this->CI->config->item('msg_success')); It seems that the issue is in Email.php: public function subject($subject) { $subject = $this->_prep_q_encoding($subject); $this->_set_header('Subject', $subject); return $this; } In the final mail, I get Subject: =?utf-8?Q?Chanel_et_RABE_REGIS_vous_invitent_=c3=a0_d=c3=a9couvrir_un_co ?= =?utf-8?Q?ntenu_chanel_makeup_confidential?= Instead of : Subject: =?utf-8?Q?Chanel_et_RABE_REGIS_vous_invitent_=c3=a0_d=c3=a9couvrir_un_contenu_chanel_makeup_confidential?= It seems that it adds a new line after 75-7-5 chars
[eluser]CroNiX[/eluser]
That's what the spec, RFC2822 Section 2.1.1, seems to call for. Quote:There are two limits that this standard places on the number of Then, in 2.2.3 it says: Quote:Each header field is logically a single line of characters comprisingSo, you are going against the standards and will probably have unpredictable results depending on email servers and the email client the end user is using. Not really a good idea if you want to better ensure delivery.
[eluser]InsiteFX[/eluser]
I guess they can not read your signature CroNiX lol! Maybe you need to make it bigger...
[eluser]FranckRR[/eluser]
OK. Next time code will be wrapped. So you tell me that if I follow the standard, I'll have to live with a random space in my subject ... So this is it. End of discussion... Even it's stupid. Just make a try. Use the Email library, encode in utf-8 french text in a subject longer that 100 chars and you will see how stupid is : the RFC or the CI implementation (I let you pick one) Just for the records, I created a My_Email.php where for subject, I bypass the limitation (75)
[eluser]CroNiX[/eluser]
Yes you can easily bypass it, but the receiving hosts email server might mangle it, classify it as spam or reject it outright and the end recipient might then not then receive it. Since you probably don't have control of what the receiving email server (or email reader) will do with email that doesn't conform to the standards, it would probably be best to ask yourself if it is absolutely necessary to have a subject line that long or if it can be shortened a bit.
[eluser]FranckRR[/eluser]
So there's no solution ? btw, I don't understand - probably due to my poor english understanding - MUST be less that 998 and SHOULD be less that 75
[eluser]InsiteFX[/eluser]
Code: $config['wrapchars'] = 76; // Defaults is set to 76 Character count to wrap at. |
Welcome Guest, Not a member yet? Register Sign In |