Allow setting From, CC, BCC and adding attachments.

Created on 3 May 2021, about 3 years ago
Updated 18 January 2024, 5 months ago

Problem/Motivation

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.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs review

Version

1.2

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada liquidcms

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024