function setBody($body) { if(is_string($body)){ $content_type = @$this->content_type; $this->body = stristr($content_type,'text/') ? str_replace(array("\r\n","\r"),"\n", $body) : $body; if($this->_attach_html_images && $content_type == 'text/html'){ $Parser = new AkMailParser(); $Parser->extractImagesIntoInlineParts($this); } }else{ $this->body = $body; } }
public function setBody($body) { if (is_string($body)) { $content_type = @$this->content_type; $this->body = stristr($content_type, 'text/') ? str_replace(array("\r\n", "\r"), "\n", $body) : $body; if ($content_type == 'text/html') { $Parser = new AkMailParser(); $Parser->applyCssStylesToTags($this); $Parser->addBlankTargetToLinks($this); if ($this->_attach_html_images) { $Parser->extractImagesIntoInlineParts($this); } } } else { $this->body = $body; } }
function load($email_file) { if (!file_exists($email_file)) { trigger_error(Ak::t('Cannot find mail file at %path', array('%path' => $email_file)), E_USER_ERROR); } $Mail =& new AkMail((array) AkMailParser::parse(file_get_contents($email_file))); return $Mail; }
function test_mime_header_to_utf() { $headers = array("Subject: =?ISO-8859-1?Q?=C9ste_es_el_sof=E1_del_q_habl=E9_=5B?=\n\r =?ISO-8859-1?Q?Fwd=3A_Sof=E1=2E=5D_?=" => 'Subject: Éste es el sofá del q hablé [Fwd: Sofá.]', "Subject: =?ISO-8859-1?Q?=C9ste_es_el_sof=E1_del_q_habl=E9_=5B?==?ISO-8859-1?Q?Fwd=3A_Sof=E1=2E=5D_?=" => 'Subject: Éste es el sofá del q hablé [Fwd: Sofá.]', 'Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=' => 'Subject: Prüfung Prüfung', 'Subject: =?iso-8859-1?Q?RV:_=5BFwd:__chiste_inform=E1tico=5D?=' => 'Subject: RV: [Fwd: chiste informático]', 'X-Akelos-Random: =?ISO-8859-11?B?4L7U6MG7w9DK1Le41MDSvuPL6aHRuuCr1MPsv+DHzcPstOnHwiBEdWFsLUNvcmUgSW50ZWwoUikgWGVvbihSKSBQcm9jZXNzb3Ig48vB6A==?=' => 'X-Akelos-Random: เพิ่มประสิทธิภาพให้กับเซิร์ฟเวอร์ด้วย Dual-Core Intel(R) Xeon(R) Processor ใหม่', 'X-Akelos-Random: =?UTF-8?B?0KDRg9GB0YHQutC40Lkg5Lit5paHINei15HXqNeZ16o=?=' => 'X-Akelos-Random: Русский 中文 עברית', 'X-Akelos-Random: =?UTF-8?B?ZXN0w6Egw6MgYsOkc8OqNjQ=?=' => 'X-Akelos-Random: está ã bäsê64', 'X-Akelos-Random: =?UTF-8?Q?E=C3=B1e_de_Espa=C3=B1a?= =?UTF-8?Q?_Fwd:_?= =?UTF-8?Q?=E3=81=93=E3=82=93=E3=81=AB=E3=81=A1=E3=81=AF=E4=B8=96=E7=95=8C?=' => 'X-Akelos-Random: Eñe de España Fwd: こんにちは世界', 'From: =?ISO-8859-1?Q?Crist=F3bal_G=F3mez_Moreno?= <*****@*****.**>' => 'From: Cristóbal Gómez Moreno <*****@*****.**>', "Subject: =?ISO-8859-1?Q?=C9ste_es_el_sof=E1_del_q_habl=E9_=5B?=\n =?ISO-8859-1?Q?Fwd=3A_Sof=E1=2E=5D_?=" => 'Subject: Éste es el sofá del q hablé [Fwd: Sofá.]'); $raw_mail = join("\r\n", array_keys($headers)) . "\r\n\r\nMail body"; $Mail = AkMailParser::parse($raw_mail); foreach ($Mail->headers as $k => $header) { $this->assertEqual($header['name'] . ': ' . $header['value'], array_shift(array_slice($headers, $k, 1))); } }
function getParsedMessageBody($body) { $Parser = new AkMailParser($this->options); $this->body = $Parser->parse($body); }