]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add tags and headers to improve email summary deliverability
authorEvan Prodromou <evan@status.net>
Tue, 21 Jun 2011 18:07:10 +0000 (14:07 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 21 Jun 2011 18:07:10 +0000 (14:07 -0400)
SpamAssassin doesn't like HTML email without a) a Mime-Version header
and b) an <html> tag in the body. Although not everyone uses SA, there
are probably other spam systems that implement similar rules. And it's
always nice to play nice.

plugins/EmailSummary/useremailsummaryhandler.php

index f03e8a1dcdfddca3a50b4f3f5db5d35aab14136c..61542e4f3b851f78802c02871dad145b780d0e29 100644 (file)
@@ -120,8 +120,16 @@ class UserEmailSummaryHandler extends QueueHandler
             $new_top = $notice->_items[0]->id;
         }
 
+        // TRANS: Subject for e-mail.
+        $subject = sprintf(_m('Your latest updates from %s'), common_config('site', 'name'));
+
         $out = new XMLStringer(true);
 
+        $out->elementStart('html');
+        $out->elementStart('head');
+        $out->element('title', null, $subject);
+        $out->elementEnd('head');
+        $out->elementStart('body');
         $out->elementStart('div', array('width' => '100%',
                                         'style' => 'background-color: #ffffff; border: 4px solid #4c609a; padding: 10px;'));
 
@@ -201,19 +209,18 @@ class UserEmailSummaryHandler extends QueueHandler
                           common_config('site', 'name'))."</p>");
 
         $out->elementEnd('div');
+        $out->elementEnd('body');
+        $out->elementEnd('html');
 
         $body = $out->getString();
 
         // FIXME: do something for people who don't like HTML email
 
-        $subject = sprintf(_m('Your latest updates from %s'), common_config('site', 'name'));
-
-        // TRANS: Subject for e-mail.
-
         mail_to_user($user,
                      $subject,
                      $body,
-                     array('Content-Type' => 'text/html; charset=UTF-8'));
+                     array('Content-Type' => 'text/html; charset=utf-8',
+                           'Mime-Version' => '1.0'));
 
         if (empty($ess)) {
             $ess = new Email_summary_status();