php - unable to send email as both plain text and html in cakephp -
    app::uses('cakeemail', 'network/email');     $email = new cakeemail();     $email->to($emailcontentarray['to']);     $email->from(array($emailcontentarray['from'] => configure::read('from_name')));     $email->subject($emailcontentarray['subject']);     $email->emailformat('both');     $response=$email->send($emailcontentarray['body']); if check resulting email looks like:-
content-type: multipart/mixed; boundary="782f009f669cbcf2faafff59fe0eeb5d" content-transfer-encoding: 8bit x-identified-user: {:test25.xyzzzz.com:testttt.com} {sentby:program running on server}  --782f009f669cbcf2faafff59fe0eeb5d content-type: multipart/alternative; boundary="alt-782f009f669cbcf2faafff59fe0eeb5d"  --alt-782f009f669cbcf2faafff59fe0eeb5d content-type: text/plain; charset=utf-8 content-transfer-encoding: 8bit  <div>​<br>hi<br><br>soon reach action limit. keep updated please pay payment.<br><br> happy to  have you<br><br>thanks,<br>apps team<br>​</div>   --alt-782f009f669cbcf2faafff59fe0eeb5d content-type: text/html; charset=utf-8 content-transfer-encoding: 8bit  <div>​<br>hi<br><br>soon reach action limit. keep updated please pay payment.<br><br> happy to  have you<br><br>thanks,<br>apps team<br>​</div> in text/plain email should not show html tags - how can both html , plain text sent correctly?
encode content , subject in base64:  "=?utf-8?b?".base64_encode($s)."?=";
and before sending emails don't forget set header:
'content-transfer-encoding: base64'; if i'm not wrong can make set header: $email->setheader('x-content-transfer-encoding', 'base64');
you can take @ cakephp sending utf-8 emails , linelength , @ http://book.cakephp.org/2.0/en/core-utility-libraries/email.html
Comments
Post a Comment