aboutsummaryrefslogtreecommitdiffstats
path: root/include/email.php
diff options
context:
space:
mode:
authorMichael <icarus@dabo.de>2012-02-24 08:50:42 +0100
committerMichael <icarus@dabo.de>2012-02-24 08:50:42 +0100
commit0ba45eb74543fc6377c48ac17d8b632e431e9467 (patch)
treee0006e486df5e02031fb0d61195f3674090970ae /include/email.php
parentf6320f3319a8009c7bdf51035b226f0ea688d8bd (diff)
downloadvolse-hubzilla-0ba45eb74543fc6377c48ac17d8b632e431e9467.tar.gz
volse-hubzilla-0ba45eb74543fc6377c48ac17d8b632e431e9467.tar.bz2
volse-hubzilla-0ba45eb74543fc6377c48ac17d8b632e431e9467.zip
Sending mail as multipart/alternative (html and plain text) (very basic by now)
Diffstat (limited to 'include/email.php')
-rwxr-xr-xinclude/email.php41
1 files changed, 40 insertions, 1 deletions
diff --git a/include/email.php b/include/email.php
index 452682260..fee3e2f68 100755
--- a/include/email.php
+++ b/include/email.php
@@ -1,4 +1,5 @@
<?php
+require_once('include/html2plain.php');
function email_connect($mailbox,$username,$password) {
if(! function_exists('imap_open'))
@@ -224,6 +225,44 @@ function email_header_encode($in_str, $charset) {
$out_str = $start . $out_str . $end;
}
return $out_str;
-}
+}
+
+function email_send($addr, $subject, $headers, $item) {
+ //$headers .= 'MIME-Version: 1.0' . "\n";
+ //$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";
+ $html = prepare_body($item);
+
+ $headers .= "Mime-Version: 1.0\n";
+ $headers .= 'Content-Type: multipart/alternative; boundary="=_1f5dbdf8dbd0a060ea5bc3050bb14c6a"'."\n\n";
+
+ $body = "--=_1f5dbdf8dbd0a060ea5bc3050bb14c6a\n";
+ $body .= "Content-Transfer-Encoding: quoted-printable\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 .= "Content-Type: text/html; charset=utf-8\n\n";
+
+ $body .= $html."\n\n";
+ $body .= "--=_1f5dbdf8dbd0a060ea5bc3050bb14c6a--\n";
+
+ //$message = '<html><body>' . $html . '</body></html>';
+ //$message = html2plain($html);
+ logger('notifier: email delivery to ' . $addr);
+ mail($addr, $subject, $body, $headers);
+}
+
+function email_cleanupmessageid($messageid) {
+ global $a;
+
+ if (!strpos($messageid, '@'))
+ $messageid = str_replace(":", ".", $messageid).'@'.$a->get_hostname();
+
+ return($messageid);
+}