Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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().
Comment | File | Size | Author |
---|---|---|---|
#16 | message_notifier-2300223-16-8.x.patch | 1.33 KB | gordon |
| |||
#13 | message_notify-2300223-13.patch | 3.08 KB | RoSk0 |
|
Comments
Comment #4
amitaibuYou need to git diff correctly.
Comment #5
Snir CreditAttribution: Snir commentedPatch fix.
Comment #6
amitaibuCorrect status
Comment #7
jantoine CreditAttribution: jantoine commentedThe attached patch incorporates this change into Rules as well.
Comment #8
philipz CreditAttribution: philipz commentedPatch #7 applies cleanly but does not work form me. I'm sending e-mail using Mandrill so maybe this is the problem for me.
Comment #9
gbirch CreditAttribution: gbirch commentedTo 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.
Comment #10
RoSk0PR 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.
Comment #11
vbard CreditAttribution: vbard as a volunteer commented#10 worked for me, much thanks!
Comment #12
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedneeds 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
Comment #13
RoSk0Re-rolled patch version.
Also updated pull request in GitHub.
Comment #14
ghadaezzat CreditAttribution: ghadaezzat commentedI 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
Comment #15
znerol CreditAttribution: znerol commentedThe patch in #13 looks fine. Help messages are easy to understand, code style is okay. The patch works just great, thanks!
Comment #16
gordon CreditAttribution: gordon at Heydon Consulting for Pfizer, Inc. commentedI have updated this patch for 8.x
Comment #19
bluegeek9 CreditAttribution: bluegeek9 as a volunteer commented