I think it will be reasonable to have an option to disable the welcome emails.
It's possible to customize them, but not to disable them!
There are 6 email settings configurable from user settings:
Welcome (new user created by administrator)
--> When admin crates the new user, there is a checkbox "Notify user", so it's not needed in this page)
Welcome (awaiting approval)
--> (Missing!)
Welcome (no approval required)
--> (Missing!)
Account activation
--> (There is a checkbox for disabling)
Account blocked
--> (There is a checkbox for disabling)
Account cancellation confirmation
--> (Missing! But maybe shouldn't be in the admin hands if a user wants to cancel its account)
Account canceled
--> (There is a checkbox for disabling)
Password recovery.
--> (Missing!)
Maybe it's obvious that should be always on these welcome emails. But what about a web site who register their users via SMS for example, and not email? Or probably there is more use cases.
It's attached a starting patch that only adds notification checkboxes to the form, for two of the welcome messages.
With only this minimal patch will work, because the way is implemented the notification code in the _submit.
It will need more work, and possibility to modify also the message in the screen. (It's silly that email is not sent, but user sees the message "A welcome message with further instructions has been sent to your e-mail address."
I wanted to hear first more opinions or if there is some duplicated issues.
Thanks.
Comment | File | Size | Author |
---|---|---|---|
notifications_welcome_email.patch | 1.74 KB | corbacho | |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedBah. This is pretty edge case. Can be solve in contrib with hook_mail_alter or somesuch.
Comment #2
corbacho CreditAttribution: corbacho commentedTrue, quite edge case.
Other use cases:
* You may want to send a different welcome email, because you want to include some extra stuff that the default tokens of Drupal doesn't let you.
* You may want to replace the text email with a MIME email with your logo.
* You don't want site_email to be the "From" of the email. You want to assign it to support@email.com
* You may want to use Rules module to send emails to new users instead of default email
hook_mail_alter it's a hack-work-around.
You can filter emails by using $mailkey id (for example id can be "user_register_no_approval_required") but then what? Your way of disable the email is to send it to a wrong address? Not very elegant
Also what about the collateral problem of being displayed a message in the screen "A welcome message with further instructions has been sent to your e-mail address."
It's impossible to customize that unless you use "String overrides" module or other hack arounds, when is soo simple to have a checkbox in the user settings page.
Sorry, I change the issue to 8.x. and I will work in a contrib module to alter the 'user_admin_settings' and submit function of registration.
More opinions about this matter?
I found this interesting thread too http://drupal.org/node/257202 Disable registration welcome email
Comment #3
goldhat CreditAttribution: goldhat commentedI was a little surprised today to learn that we cannot shut off the User Welcome emails, at least not in any reasonable sort of way. I think will end up resorting to making a copy of the user module and storing it under /sites/all/modules/user/ and then altering its mailing functions directly. In the site I'm building, we want the first thing the user sees after buying from our store to the be the Ubercart order summary, and we've built the "welcome" message into that with username/password. There is no way we want a plain-text little message going out first, and leaving the user confused.
Definitely this get's my vote for D8!
Comment #4
goldhat CreditAttribution: goldhat commentedFollowup on this issue, does anyone know if it possible to use hook_alter_mail to prevent an email from being sent at all? Is that an option by for example returning false?
Comment #5
andymantell CreditAttribution: andymantell commentedSubscribing. A hook_mail_alter solution would be more than adequate, but the method for disabling the emails needs to be more elegant than setting the "to" value to something erroneous.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedif we get #800434: drupal_mail, allow hook_mail_alter implementation to cancel mail, this is minor.
Comment #7
andypostAnother way is #286401: Make email not required for a Drupal site account
Comment #8
kris_mcl CreditAttribution: kris_mcl commentedHere's a nice solution I found this morning while looking for a good way to disable the welcome email. It adds a simple "Send" checkbox to the user settings form right under the "Welcome, no approval required" message body.
http://drupal.org/node/257202#comment-3604134
Comment #9
sphism CreditAttribution: sphism commented#8 - that looks pretty similar to the approach in the original patch.
I was just having a look at user_register_submit and it looks a bit messy to me, is it worth rewriting it a bit?
it seems like it would be nice to separate out all those if / elseif / admin / notify bits.
Then the $notify variable could use the suggested tick boxes from the first patch
not sure though.
Comment #10
star-szrThis
hook_mail_alter()
should work in Drupal 7.12+ for cancelling the Welcome (no approval required) email. To find the other IDs, see_user_mail_notify()
in user.module. Just remember to prefix the message ID withuser_
in yourhook_mail_alter()
.Comment #11
Juc1 CreditAttribution: Juc1 commented@ Cottser or anyone, sorry for being thick but where do I put this code in D7?
Thanks
Comment #12
karan_mudi CreditAttribution: karan_mudi commentednotifications_welcome_email.patch queued for re-testing.
Comment #14
reszliSorry, I think this is not the right place for me to post this...
I just added a small module that solves this issue in D7:http://drupal.org/sandbox/reszli/1846498
It is currently undergoing the project application process (maybe you can help speed it up):
http://drupal.org/node/1856330
but it would really be nice to have an option in core to turn off welcome emails.
Comment #15
Taxoman CreditAttribution: Taxoman commentedRelated contrib. module: http://drupal.org/project/mailcontrol
IMO, Drupal core should offer the basic checkboxes to enable/disable each outgoing email.
Beyond that, contributed modules can extend it, alter behaviour, etc.
Comment #16
jackenmailWe have set some settings in settings.php.
add the following line at the end of settings.php
$conf['register_admin_created'] = FALSE;
for more operation see _user_mail_notify.
Comment #19
suresh.senthatti CreditAttribution: suresh.senthatti commentedWhen i cancel the account with Require email confirmation to cancel account the email configuration are not getting.
Could anyone help me on this in Drupal 8
Comment #20
webcultist CreditAttribution: webcultist commentedI still think that it would be a good idea to bring that to core. Even the contrib module that enables in D8 the functionality does not work.
Even the info.yml file is missing there.
Comment #25
karan_mudi CreditAttribution: karan_mudi commentedComment #26
idebr CreditAttribution: idebr at iO commented#25 Why the change to fixed? The issue described in the issue summary is still applicable in 8.6.x
Comment #29
voleger