- Merge request !6Issue #3211901: Allow setting From, CC, BCC and adding attachments. → (Open) created by gorkagr
- First commit to issue fork.
- last update
about 1 year ago 10 pass
Wondering if there is some sort of security issue with allowing MN to set the From address. By this i mean the real From address. For some reason the MN code refers to the "reply to" value as "from". I don't think this is a standard use of this term and it doesn't match with Drupal's core MailManagerInterface:
public function mail($module, $key, $to, $langcode, $params = [], $reply = NULL, $send = TRUE);
where MN's $from variable is what is sent to mail() as $reply.
I know there are other modules (like Business Rules) which set the From address as the site's address unless the rule is set to use something else.
To set the From address the Email->deliver() method simply needs to set the From header. This can be transferred now from the $notifier->send() method like this:
$headers['From'] = 'from@example.com';
$options = [
'mail' => 'to@example.com',
'context' => $policy,
'output' => [
'headers' => $headers,
],
'from' => 'REPLY@example.com',
];
$notifier->send($message, $options);
The only issue is that the deliver method doesn't pass along the rest of $output (should really be called $params to be consistent with core MailInterface) values sent along.
Perhaps some reason this isn't supported; but i'll post a patch to support this. Would be great to rename the variables to better line up with core variables; but i'll leave that for now.
Needs review
1.2
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.