Cakephp sending UTF-8 Emails and lineLength -


i'm trying send emails utf8 characters. email looks how suspect, randomly there garbage characters. believe garbage characters happen when new line inserted in middle of 1 of characters. suspect cakephp's email component culprit since reading has feature insert new lines according linelength property. there way fix this? i'm using cakephp 1.3.

$this->email->to = $sendemail; $this->email->from = empty($this->data['contact']['email']) ? $sendemail : $this->data['contact']['email']; $this->email->subject = $subject; $this->email->sendas = 'text'; $this->email->template = 'contact' $this->set('fields', $this->data['contact']); $this->email->charset = "utf-8"; $this->email->headercharset = "utf-8"; return $this->email->send(); 

from email header:

content-type: text/plain; charset=utf-8 content-transfer-encoding: 7bit 

i discovered problem can solved encoding email message in base64. cakephp's email component not natively this, wrote class email64 extend email component. rewrote functions contained

'content-transfer-encoding: 7bit'; 

to

'content-transfer-encoding: base64'; 

and in _mail() function, replaced calls php's mail function -- --

return @mail($to, $this->_encode($this->subject),  $message, $header, $this->additionalparams); 

to --

return @mail($to, $this->_encode($this->subject),  rtrim(chunk_split(base64_encode($message))), $header, $this->additionalparams); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -