mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Move some message checks to MailSo\Mime\Message
This commit is contained in:
parent
d629f42e4c
commit
353fdda3e5
2 changed files with 26 additions and 40 deletions
|
|
@ -179,16 +179,19 @@ class Message extends Part
|
||||||
|
|
||||||
public function SetInReplyTo(string $sInReplyTo) : self
|
public function SetInReplyTo(string $sInReplyTo) : self
|
||||||
{
|
{
|
||||||
$this->aHeadersValue[Enumerations\Header::IN_REPLY_TO] = $sInReplyTo;
|
$sInReplyTo = \trim($sInReplyTo);
|
||||||
|
if (\strlen($sInReplyTo)) {
|
||||||
|
$this->aHeadersValue[Enumerations\Header::IN_REPLY_TO] = $sInReplyTo;
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetReferences(string $sReferences) : self
|
public function SetReferences(string $sReferences) : self
|
||||||
{
|
{
|
||||||
$this->aHeadersValue[Enumerations\Header::REFERENCES] =
|
$sReferences = \MailSo\Base\Utils::StripSpaces($sReferences);
|
||||||
\MailSo\Base\Utils::StripSpaces($sReferences);
|
if (\strlen($sReferences)) {
|
||||||
|
$this->aHeadersValue[Enumerations\Header::REFERENCES] = $sReferences;
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,8 +242,9 @@ class Message extends Part
|
||||||
|
|
||||||
public function SetTo(EmailCollection $oEmails) : self
|
public function SetTo(EmailCollection $oEmails) : self
|
||||||
{
|
{
|
||||||
$this->aHeadersValue[Enumerations\Header::TO_] = $oEmails;
|
if ($oEmails->count()) {
|
||||||
|
$this->aHeadersValue[Enumerations\Header::TO_] = $oEmails;
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -253,22 +257,25 @@ class Message extends Part
|
||||||
|
|
||||||
public function SetReplyTo(EmailCollection $oEmails) : self
|
public function SetReplyTo(EmailCollection $oEmails) : self
|
||||||
{
|
{
|
||||||
$this->aHeadersValue[Enumerations\Header::REPLY_TO] = $oEmails;
|
if ($oEmails->count()) {
|
||||||
|
$this->aHeadersValue[Enumerations\Header::REPLY_TO] = $oEmails;
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetCc(EmailCollection $oEmails) : self
|
public function SetCc(EmailCollection $oEmails) : self
|
||||||
{
|
{
|
||||||
$this->aHeadersValue[Enumerations\Header::CC] = $oEmails;
|
if ($oEmails->count()) {
|
||||||
|
$this->aHeadersValue[Enumerations\Header::CC] = $oEmails;
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetBcc(EmailCollection $oEmails) : self
|
public function SetBcc(EmailCollection $oEmails) : self
|
||||||
{
|
{
|
||||||
$this->aHeadersValue[Enumerations\Header::BCC] = $oEmails;
|
if ($oEmails->count()) {
|
||||||
|
$this->aHeadersValue[Enumerations\Header::BCC] = $oEmails;
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -989,10 +989,7 @@ trait Messages
|
||||||
$oFrom = $oMessage->GetFrom();
|
$oFrom = $oMessage->GetFrom();
|
||||||
$oMessage->RegenerateMessageId($oFrom ? $oFrom->GetDomain() : '');
|
$oMessage->RegenerateMessageId($oFrom ? $oFrom->GetDomain() : '');
|
||||||
|
|
||||||
$oReplyTo = new \MailSo\Mime\EmailCollection($this->GetActionParam('replyTo', ''));
|
$oMessage->SetReplyTo(new \MailSo\Mime\EmailCollection($this->GetActionParam('replyTo', '')));
|
||||||
if ($oReplyTo->count()) {
|
|
||||||
$oMessage->SetReplyTo($oReplyTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->GetActionParam('readReceiptRequest', 0))) {
|
if (!empty($this->GetActionParam('readReceiptRequest', 0))) {
|
||||||
// Read Receipts Reference Main Account Email, Not Identities #147
|
// Read Receipts Reference Main Account Email, Not Identities #147
|
||||||
|
|
@ -1010,35 +1007,17 @@ trait Messages
|
||||||
|
|
||||||
$oMessage->SetSubject($this->GetActionParam('subject', ''));
|
$oMessage->SetSubject($this->GetActionParam('subject', ''));
|
||||||
|
|
||||||
$oToEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('to', ''));
|
$oMessage->SetTo(new \MailSo\Mime\EmailCollection($this->GetActionParam('to', '')));
|
||||||
if ($oToEmails->count()) {
|
$oMessage->SetCc(new \MailSo\Mime\EmailCollection($this->GetActionParam('cc', '')));
|
||||||
$oMessage->SetTo($oToEmails);
|
$oMessage->SetBcc(new \MailSo\Mime\EmailCollection($this->GetActionParam('bcc', '')));
|
||||||
}
|
|
||||||
|
|
||||||
$oCcEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('cc', ''));
|
|
||||||
if ($oCcEmails->count()) {
|
|
||||||
$oMessage->SetCc($oCcEmails);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oBccEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('bcc', ''));
|
|
||||||
if ($oBccEmails->count()) {
|
|
||||||
$oMessage->SetBcc($oBccEmails);
|
|
||||||
}
|
|
||||||
|
|
||||||
$aDraftInfo = $this->GetActionParam('draftInfo', null);
|
$aDraftInfo = $this->GetActionParam('draftInfo', null);
|
||||||
if ($bWithDraftInfo && \is_array($aDraftInfo) && !empty($aDraftInfo[0]) && !empty($aDraftInfo[1]) && !empty($aDraftInfo[2])) {
|
if ($bWithDraftInfo && \is_array($aDraftInfo) && !empty($aDraftInfo[0]) && !empty($aDraftInfo[1]) && !empty($aDraftInfo[2])) {
|
||||||
$oMessage->SetDraftInfo($aDraftInfo[0], $aDraftInfo[1], $aDraftInfo[2]);
|
$oMessage->SetDraftInfo($aDraftInfo[0], $aDraftInfo[1], $aDraftInfo[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sInReplyTo = $this->GetActionParam('inReplyTo', '');
|
$oMessage->SetInReplyTo($this->GetActionParam('inReplyTo', ''));
|
||||||
if (\strlen($sInReplyTo)) {
|
$oMessage->SetReferences($this->GetActionParam('references', ''));
|
||||||
$oMessage->SetInReplyTo($sInReplyTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sReferences = $this->GetActionParam('references', '');
|
|
||||||
if (\strlen($sReferences)) {
|
|
||||||
$oMessage->SetReferences($sReferences);
|
|
||||||
}
|
|
||||||
|
|
||||||
$aFoundCids = array();
|
$aFoundCids = array();
|
||||||
$aFoundDataURL = array();
|
$aFoundDataURL = array();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue