Added originalTo and originalCc headers

This commit is contained in:
Will Browning 2021-11-26 12:36:49 +00:00
parent 339af302cc
commit 9bfc7baba9
6 changed files with 624 additions and 434 deletions

View file

@ -243,7 +243,7 @@ To resolve this you simply need to add a DMARC record, for example:
| Type | Host | Value | | Type | Host | Value |
|:-----|:-------|:----------------------------| |:-----|:-------|:----------------------------|
| TXT | _dmarc | "v=DMARC1; p=none; adkim=s" | | TXT | _dmarc | "v=DMARC1; p=quarantine; adkim=s" |
You should also have SPF and DKIM records in place. You should also have SPF and DKIM records in place.

View file

@ -29,6 +29,8 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
protected $user; protected $user;
protected $alias; protected $alias;
protected $sender; protected $sender;
protected $originalCc;
protected $originalTo;
protected $displayFrom; protected $displayFrom;
protected $replyToAddress; protected $replyToAddress;
protected $emailSubject; protected $emailSubject;
@ -60,6 +62,8 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
$this->user = $alias->user; $this->user = $alias->user;
$this->alias = $alias; $this->alias = $alias;
$this->sender = $emailData->sender; $this->sender = $emailData->sender;
$this->originalCc = $emailData->originalCc ?? null;
$this->originalTo = $emailData->originalTo ?? null;
$this->displayFrom = $emailData->display_from; $this->displayFrom = $emailData->display_from;
$this->replyToAddress = $emailData->reply_to_address ?? $this->sender; $this->replyToAddress = $emailData->reply_to_address ?? $this->sender;
$this->emailSubject = $emailData->subject; $this->emailSubject = $emailData->subject;
@ -205,6 +209,16 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
$message->getHeaders() $message->getHeaders()
->addTextHeader('X-New-Cids', implode(',', $newCids)); ->addTextHeader('X-New-Cids', implode(',', $newCids));
} }
if ($this->originalCc) {
$message->getHeaders()
->addTextHeader('X-AnonAddy-Original-Cc', $this->originalCc);
}
if ($this->originalTo) {
$message->getHeaders()
->addTextHeader('X-AnonAddy-Original-To', $this->originalTo);
}
}); });
if ($this->emailText) { if ($this->emailText) {

View file

@ -13,6 +13,15 @@ class EmailData
if (isset($parser->getAddresses('reply-to')[0])) { if (isset($parser->getAddresses('reply-to')[0])) {
$this->reply_to_address = $parser->getAddresses('reply-to')[0]['address']; $this->reply_to_address = $parser->getAddresses('reply-to')[0]['address'];
} }
if ($originalCc = $parser->getHeader('cc')) {
$this->originalCc = $originalCc;
}
if ($originalTo = $parser->getHeader('to')) {
$this->originalTo = $originalTo;
}
$this->subject = base64_encode($parser->getHeader('subject')); $this->subject = base64_encode($parser->getHeader('subject'));
$this->text = base64_encode($parser->getMessageBody('text')); $this->text = base64_encode($parser->getMessageBody('text'));
$this->html = base64_encode($parser->getMessageBody('html')); $this->html = base64_encode($parser->getMessageBody('html'));

394
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -5,9 +5,9 @@ current:
major: 0 major: 0
minor: 8 minor: 8
patch: 7 patch: 7
prerelease: 1-gdbe26b8 prerelease: 2-g339af30
buildmetadata: '' buildmetadata: ''
commit: dbe26b commit: 339af3
timestamp: timestamp:
year: 2020 year: 2020
month: 10 month: 10

635
package-lock.json generated

File diff suppressed because it is too large Load diff