aboutsummaryrefslogtreecommitdiffstats
path: root/include/email.php
diff options
context:
space:
mode:
authorMichael <icarus@dabo.de>2012-02-25 01:10:45 +0100
committerMichael <icarus@dabo.de>2012-02-25 01:10:45 +0100
commita74b0746b1e39d86aca4f665cfded03e6b344240 (patch)
treeb1da5791878ce39e06dfb0e3e2f2e5d0436b32f1 /include/email.php
parent0ba45eb74543fc6377c48ac17d8b632e431e9467 (diff)
downloadvolse-hubzilla-a74b0746b1e39d86aca4f665cfded03e6b344240.tar.gz
volse-hubzilla-a74b0746b1e39d86aca4f665cfded03e6b344240.tar.bz2
volse-hubzilla-a74b0746b1e39d86aca4f665cfded03e6b344240.zip
multipart messages complete, message-id conversion done.
Diffstat (limited to 'include/email.php')
-rwxr-xr-xinclude/email.php37
1 files changed, 23 insertions, 14 deletions
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><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">'.$html."</body></html>\n";
- $body .= "--=_1f5dbdf8dbd0a060ea5bc3050bb14c6a--\n";
+ $body .= "--=_".$part."--";
//$message = '<html><body>' . $html . '</body></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);
+}