Add List-Unsubscribe header to emails [MAILPOET-793]

Amazon SES supports custom headers only via 'SendRawEmail' action
MailPoet Sending Service doesn't support custom headers yet
This commit is contained in:
Alexey Stoletniy
2017-01-26 15:38:23 +03:00
parent e77717c4c2
commit dd2df429ef
11 changed files with 146 additions and 43 deletions

View File

@@ -33,15 +33,21 @@ class SendGridTest extends MailPoetTest {
'text' => 'TEXT body'
)
);
$this->extra_params = array(
'unsubscribe_url' => 'http://www.mailpoet.com'
);
}
function testItCanGenerateBody() {
$body = $this->mailer->getBody($this->newsletter, $this->subscriber);
$body = $this->mailer->getBody($this->newsletter, $this->subscriber, $this->extra_params);
expect($body['to'])->contains($this->subscriber);
expect($body['from'])->equals($this->sender['from_email']);
expect($body['fromname'])->equals($this->sender['from_name']);
expect($body['replyto'])->equals($this->reply_to['reply_to_email']);
expect($body['subject'])->equals($this->newsletter['subject']);
$headers = json_decode($body['headers'], true);
expect($headers['List-Unsubscribe'])
->equals('<' . $this->extra_params['unsubscribe_url'] . '>');
expect($body['html'])->equals($this->newsletter['body']['html']);
expect($body['text'])->equals($this->newsletter['body']['text']);
}