Problem/Motivation

The 'from' parameter currently is not configurable.

Proposed resolution

  • Modify the deliver() method of the MessageNotifierEmail class to check for a 'from' option
  • Extend the email plugin to specify the 'from' option and allow it to be overridden
  • Modify the 'message_notify_process' Rules action to allow the 'from' parameter to be specified
  • Modify the message_notify_rules_process() function to take a 'from' parameter

Remaining tasks

  • Review patch
  • Commit

User interface changes

Adds a text field to the 'message_notify_rules' action.

API changes

Modifies the message_notify_rules_process() function to take an optional 'from' parameter.

Original report by Snir

Can't pass the "from" header in the drupal_mail().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, pass-from-mail.patch, failed testing.

Status: Needs work » Needs review

Snir queued pass-from-mail.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, pass-from-mail.patch, failed testing.

amitaibu’s picture

You need to git diff correctly.

Snir’s picture

FileSize
738 bytes

Patch fix.

amitaibu’s picture

Status: Needs work » Needs review

Correct status

jantoine’s picture

Title: Passing the from name header to the drupal_mail() » The 'from' parameter is not configurable
Issue summary: View changes
FileSize
2.75 KB

The attached patch incorporates this change into Rules as well.

philipz’s picture

Patch #7 applies cleanly but does not work form me. I'm sending e-mail using Mandrill so maybe this is the problem for me.

gbirch’s picture

To philipz - I don't know whether you still have the problem, but you should be aware that the Mandrill module has an idiosyncratic approach to customizing who an email is from. There are two variables, the 'from_email' and the 'from_name'. To override the from_email, you have to set $message['params']['mandrill']['overrides']['from_email'] to your custom value. To set the from_name, you have to set $message['params']['mandrill']['from_name']. In connection with this, you may also want to set the "Reply-To" header. Happily this is normal: $message['headers']['Reply-To']. In the absence of these settings, the Mandrill module will use the site defaults. For reference, see the mail() function in mandrill.mail.inc.

RoSk0’s picture

FileSize
3.08 KB

PR with the fix for the current issue https://github.com/Gizra/message_notify/pull/8 as well as patch from specified PR.

The patch applies cleanly as solves the issue. Obviously I can't set it to RTBC.

vbard’s picture

#10 worked for me, much thanks!

SocialNicheGuru’s picture

needs to be rerolled

message_notify
; Information added by Drupal.org packaging script on 2016-05-26
version = "7.x-2.5+6-dev"
core = "7.x"

patch -p1 < message_notify-pass_from_email-2300223-10.patch
patching file message_notify.rules.inc
patching file plugins/notifier/email/MessageNotifierEmail.class.php
Hunk #1 succeeded at 21 (offset 8 lines).
Hunk #2 FAILED at 29.
1 out of 2 hunks FAILED -- saving rejects to file plugins/notifier/email/MessageNotifierEmail.class.php.rej
patching file plugins/notifier/email/email.inc

RoSk0’s picture

FileSize
3.08 KB

Re-rolled patch version.
Also updated pull request in GitHub.

ghadaezzat’s picture

I used the patch #13 and when I debugged the code it work ,but when sending emails ,it takes from parameter from configuration from smtp server,do you know how to override this configuration from drupal

znerol’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #13 looks fine. Help messages are easy to understand, code style is okay. The patch works just great, thanks!

gordon’s picture

I have updated this patch for 8.x

  • jhedstrom authored 6bd6419 on 8.x-1.x
    Merge pull request #73 from gheydon/8.x-1.x
    
    Issue #2300223 by Snir,...
  • gordon committed e976fa2 on 8.x-1.x
    Issue #2300223 by Snir, RoSk0, jantoine: The 'from' parameter is not...

bluegeek9’s picture

Status: Reviewed & tested by the community » Closed (outdated)