Merge pull request #1112 from Rudloff/feature/unsubscribe

Add unsubscribe button
This commit is contained in:
RainLoop Team 2016-07-17 18:04:26 +03:00 committed by GitHub
commit c148e19ea3
9 changed files with 53 additions and 1 deletions

View file

@ -172,7 +172,8 @@ class MailClient
\MailSo\Mime\Enumerations\Header::REPLY_TO,
\MailSo\Mime\Enumerations\Header::DATE,
\MailSo\Mime\Enumerations\Header::SUBJECT,
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE,
\MailSo\Mime\Enumerations\Header::LIST_UNSUBSCRIBE,
), true);
}
@ -213,6 +214,7 @@ class MailClient
\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO,
\MailSo\Mime\Enumerations\Header::AUTHENTICATION_RESULTS,
\MailSo\Mime\Enumerations\Header::X_DKIM_AUTHENTICATION_RESULTS,
\MailSo\Mime\Enumerations\Header::LIST_UNSUBSCRIBE,
), true);
//
// return \MailSo\Imap\Enumerations\FetchType::ENVELOPE;

View file

@ -157,6 +157,11 @@ class Message
*/
private $sReadReceipt;
/**
* @var array
*/
private $aUnsubsribeLinks;
/**
* @var array
*/
@ -223,6 +228,7 @@ class Message
$this->sInReplyTo = '';
$this->sReferences = '';
$this->aUnsubsribeLinks = array();
$this->iSensitivity = \MailSo\Mime\Enumerations\Sensitivity::NOTHING;
$this->iPriority = \MailSo\Mime\Enumerations\MessagePriority::NORMAL;
@ -498,6 +504,14 @@ class Message
return $this->sReadReceipt;
}
/**
* @return array
*/
public function UnsubsribeLinks()
{
return $this->aUnsubsribeLinks;
}
/**
* @return string
*/
@ -686,6 +700,23 @@ class Message
$this->sReadReceipt = \trim($oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO));
}
//Unsubscribe links
$this->aUnsubsribeLinks = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::LIST_UNSUBSCRIBE);
if (empty($this->aUnsubsribeLinks))
{
$this->aUnsubsribeLinks = array();
}
else
{
$this->aUnsubsribeLinks = explode(',', $this->aUnsubsribeLinks);
$this->aUnsubsribeLinks = array_map(
function ($link) {
return trim($link, ' <>');
},
$this->aUnsubsribeLinks
);
}
$sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO);
if (0 < \strlen($sDraftInfo))
{

View file

@ -66,4 +66,6 @@ class Header
const X_MSMAIL_PRIORITY = 'X-MSMail-Priority';
const IMPORTANCE = 'Importance';
const X_PRIORITY = 'X-Priority';
const LIST_UNSUBSCRIBE = 'List-Unsubscribe';
}