From a74b0746b1e39d86aca4f665cfded03e6b344240 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 25 Feb 2012 01:10:45 +0100 Subject: multipart messages complete, message-id conversion done. --- include/email.php | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'include/email.php') diff --git a/include/email.php b/include/email.php index fee3e2f68..4fc241f24 100755 --- a/include/email.php +++ b/include/email.php @@ -232,24 +232,27 @@ function email_send($addr, $subject, $headers, $item) { //$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n"; //$headers .= 'Content-Type: text/plain; charset=UTF-8' . "\n"; //$headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n"; + + $part = uniqid("", true); + $html = prepare_body($item); $headers .= "Mime-Version: 1.0\n"; - $headers .= 'Content-Type: multipart/alternative; boundary="=_1f5dbdf8dbd0a060ea5bc3050bb14c6a"'."\n\n"; + $headers .= 'Content-Type: multipart/alternative; boundary="=_'.$part.'"'."\n\n"; - $body = "--=_1f5dbdf8dbd0a060ea5bc3050bb14c6a\n"; - $body .= "Content-Transfer-Encoding: quoted-printable\n"; + $body = "\n--=_".$part."\n"; + $body .= "Content-Transfer-Encoding: 8bit\n"; $body .= "Content-Type: text/plain; charset=utf-8; format=flowed\n\n"; $body .= html2plain($html)."\n"; - $body .= "--=_1f5dbdf8dbd0a060ea5bc3050bb14c6a\n"; - $body .= "Content-Transfer-Encoding: quoted-printable\n"; + $body .= "--=_".$part."\n"; + $body .= "Content-Transfer-Encoding: 8bit\n"; $body .= "Content-Type: text/html; charset=utf-8\n\n"; - $body .= $html."\n\n"; + $body .= ''.$html."\n"; - $body .= "--=_1f5dbdf8dbd0a060ea5bc3050bb14c6a--\n"; + $body .= "--=_".$part."--"; //$message = '' . $html . ''; //$message = html2plain($html); @@ -257,12 +260,18 @@ function email_send($addr, $subject, $headers, $item) { mail($addr, $subject, $body, $headers); } -function email_cleanupmessageid($messageid) { - global $a; - - if (!strpos($messageid, '@')) - $messageid = str_replace(":", ".", $messageid).'@'.$a->get_hostname(); - - return($messageid); +function iri2msgid($iri) { + if (!strpos($iri, "@")) + $msgid = preg_replace("/urn:(\S+):(\S+)\.(\S+):(\d+):(\S+)/i", "urn!$1!$4!$5@$2.$3", $iri); + else + $msgid = $iri; + return($msgid); } +function msgid2iri($msgid) { + if (strpos($msgid, "@")) + $iri = preg_replace("/urn!(\S+)!(\d+)!(\S+)@(\S+)\.(\S+)/i", "urn:$1:$4.$5:$2:$3", $msgid); + else + $iri = $msgid; + return($iri); +} -- cgit v1.2.3