Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
mail system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Jul 2010 at 18:39 UTC
Updated:
29 Jul 2014 at 18:55 UTC
Where hook_mail_alter() is invoked in drupal_mail() we have the $send boolean value in scope, but it's not included in the $message variable that is passed into the mail_alter. It would be helpful in some circumstances to allow users to prevent emails from sending using hook_mail_alter().
This patch provides that functionality by routing the $send value into the $message, and then doing the send check based on the value in the $message after it has run through hook_mail_alter().
| Comment | File | Size | Author |
|---|---|---|---|
| hook_mail_alter_update_send.patch | 804 bytes | mlsamuelson |
Comments
Comment #1
dmitrig01 commented+ 'send' -> $send,=> instead of ->
Please write a test if we have an email testing framework (not sure if we do), if not please attach a test module and please test it yourself :-)
Comment #2
mlsamuelson commentedThere are existing tests for the mail system in modules/simpletest/tests/mail.test. I've looked some into creating a test for the mail_alter hook, but I'm new to the test framework and it's not apparent to me how I'd go about testing a hook. I haven't found anything in the docs, and my browsing through the code hasn't helped, either.
I'd be happy to give it a go, but at this point I could use a push in the right direction. :)
Comment #3
pillarsdotnet commentedDuplicate of #800434: drupal_mail, allow hook_mail_alter implementation to cancel mail.