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.

CommentFileSizeAuthor
notifications_welcome_email.patch1.74 KBcorbacho
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

Bah. This is pretty edge case. Can be solve in contrib with hook_mail_alter or somesuch.

corbacho’s picture

Title: Option to disable welcome emails » Option to disable welcome emails and messages
Version: 7.x-dev » 8.x-dev

True, 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

goldhat’s picture

I 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!

goldhat’s picture

Followup 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?

andymantell’s picture

Subscribing. 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.

moshe weitzman’s picture

andypost’s picture

kris_mcl’s picture

Here'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

sphism’s picture

#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.

star-szr’s picture

This 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 with user_ in your hook_mail_alter().

function MYMODULE_mail_alter(&$message) {
  if ($message['id'] == 'user_register_no_approval_required') {
    $message['send'] = FALSE;
  }
}
Juc1’s picture

@ Cottser or anyone, sorry for being thick but where do I put this code in D7?

Thanks

karan_mudi’s picture

notifications_welcome_email.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, notifications_welcome_email.patch, failed testing.

reszli’s picture

Sorry, 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.

Taxoman’s picture

Related 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.

jackenmail’s picture

We 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.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

suresh.senthatti’s picture

Issue summary: View changes

When 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

webcultist’s picture

I 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.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

karan_mudi’s picture

Status: Needs work » Fixed
idebr’s picture

Status: Fixed » Needs work

#25 Why the change to fixed? The issue described in the issue summary is still applicable in 8.6.x

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

voleger’s picture

Version: 8.9.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.