01tonythomas has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/289614

Change subject: Make messages RFC 5322 compliant
......................................................................

Make messages RFC 5322 compliant

Looks like the problem was with adding all the headers again using the
addCustomHeaders function by Mailgun. We need only the Return-Path from
$headers, and that needs to be set with setReplyToAddress()

Working with bouncehandler too, as the headers are appended correctly.

Bug: T130493
Change-Id: I99e7ba0526c47a541a14f5ab1b31bd645713a324
---
M MailgunHooks.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mailgun 
refs/changes/14/289614/1

diff --git a/MailgunHooks.php b/MailgunHooks.php
index 61ba017..34bf722 100644
--- a/MailgunHooks.php
+++ b/MailgunHooks.php
@@ -45,10 +45,12 @@
                $message->setFromAddress( $from );
                $message->setSubject( $subject );
                $message->setTextBody( $body );
+               
+               // Make it work with extensions changing the return path
+               $message->setReplyToAddress( $headers['Return-Path'] );
 
-               foreach( $headers as $headerName => $headerValue ) {
-                       $message->addCustomHeader( $headerName, $headerValue );
-               }
+               $message->addCustomHeader( "X-Mailer", $headers['X-Mailer'] );
+               $message->addCustomHeader( "List-Unsubscribe", 
$headers['List-Unsubscribe'] );
 
                foreach( $to as $recip ) {
                        try {

-- 
To view, visit https://gerrit.wikimedia.org/r/289614
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99e7ba0526c47a541a14f5ab1b31bd645713a324
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to