By drozzy on
This might be a silly question but I can't seem to find the solution.
How can I disable the automatic email notification of the new user account that user sends to users after they register?
Thanks!
This might be a silly question but I can't seem to find the solution.
How can I disable the automatic email notification of the new user account that user sends to users after they register?
Thanks!
Comments
TYPO* user sends to users
TYPO*
user sends to users after they register? -> drupal sends to users after they register?
=-=
goto administer -> user settings
uncheck Require e-mail verification when a visitor creates an account
Drupal 5
I should mention I am in Drupal 5
You can disable some emails
You can disable some emails such as account activation from /admin/user/settings, but I believe if you wish to disable the registration email you'll have to edit the code.
(So not sure that this is the help you wanted...)
Magnity
http://webdesign.magnity.co.uk
I can't disable that from
I can't disable that from admin. What I am interested in disabling is the "welcome email", but in user settings it only shows the email message I can customize. I can't turn it off :-(
I am trying to find where in code can I disable it. I've look at the user module - but I can't seem to find the spot :-(((
Any help?
* bump* can at least
* bump* can at least someone tell me which module to look in?
=-=
probably the user.module though I don't advocate hacking core modules.
ha, everyone says they don't
ha, everyone says they don't advocate hacking core modules , but no-one gives alternative solutions.
It's like if someone asks me "Hey man, is there a place I can eat around here, I am really starving..."
i would answer:
"There is a burger king around the corner - but I don't advocate eating there" ???
solution...
Hey drozzy not sure if you've figured this out yet but the direct answer to your question is just hack the user.module file I had to do the same thing but my reason is because my host (hostican) has a 100 e-mail limit per month... crazy stuff... don't get me started...
anyways look for the function called user_register_submit. You'll scroll just below is and you'll find this...
comment out or remove this line and no e-mail will be sent.
Don't hack core; mod it and
Don't hack core; mod it and replace in sites/example.com/modules or via another method ;), leaving core intact; keep a patches directory or other documentation so things are clear if and when core gets updated.
Use hook_mail_alter
hook_mail_alter (http://api.drupal.org/api/function/hook_mail_alter/5) can be used to change mails sent using drupal_mail() function (such as the welcome mail). You can recognize the mail by mail ID given (for example welcome mail ID is user-register-welcome). So using something like this you can modify the mail.
I don't know a 'proper' method to disable the welcome mail (that's without counting hacking user module). But through some gimmicks we can make it look like disabling the welcome mail. Just change the $to address to some unused mail box within your mail_alter and it's as good as disabling the mail for me ;)
Buddhika
http://luckycala.wordpress.com
Star!!
Just want to say thanks to buddhika for some good advice. I spend hours and hours trying to disable the stupid welcome email without hacking core modules. The idea of just changing the 'to' address is actually pretty perfect as I can just send it to a private inbox, this inbox can be used as a backup of user information.
Drupal 6 Format
I like this solution, but can't seem to get the syntax correct to work in Drupal 6. Does anyone have a working example of the code for Drupal 6?
Thanks.
Advanced mail reroute
Try: http://drupal.org/project/advanced_mail_reroute .
It discovers mailkeys (specific places where mail is send), after which you can selectively enable, disable or reroute e-mail.
sorry if this thread is old but
The key is in _user_mail_notify function of user.module
Each email that is sent has an associated variable, which determines whether or not notification should happen for each operation.
These are in the format 'user_mail_ZZZ_notify', where ZZZ is the operation.
So, if under Administer -> User Management -> User Settings, you have selected the option "Visitors can create accounts and no administrator approval is required."
...then to prevent the emails from being sent you would set in the code for your module:
variable_set('user_mail_register_no_approval_required_notify', false);
Thanks for this insight, it
Thanks for this insight, it indeeds disables the sending of email. However, it seems to be incomplete, as a message like 'Your password and further instructions have been sent to your e-mail address.' would still appear.
Taking a look at the code, I found the following asymmetry, at line 2359 of user.module
Thus, even if _user_mail_notify does *not* send the email (with the hint above), drupal will emit a message that an email has been sent. So a complete solution does not seem possible without hacking user.module...
instead use redirect after user registration
You can use a Trigger or hook form_alter to redirect the user after registration to your custom page, to the user login page, etc. Easy and safer than core hacking.
function yourmodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'user_register') {
$form['#redirect'] = 'home';
}
}
You could also choose to automatically log the user in after registration, which is what my site does and why I failed to notice this bit you pointed out. The site I'm developing for is using Email Registration with latest the patch that automatically logs the user in after registration, thereby showing a different page to the user... so my users don't see a registration message either on screen or by email.
The example below does an auto-login for ordinary users at registration, was pinched from Email Registration module's patch and tweaked:
function yourmodule_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
global $user;
// if email verification is off and a new user is the one creating account, log the new user in with correct name
if (!variable_get('user_email_verification', 1) && $user->uid == 0) {
$user = $account;
}
break;
}
}
A nice way to do this with no
A nice way to do this with no code hacks would be to use the advanced mail reroute to nuke the emails you want to get rid of, and then the string overrides module to alter the messages.
In Drupal 6 you can set a
In Drupal 6 you can set a variable that will contole the email.
Add this variable to your site and set it to false to disable sending welcome emails.
variable: user_mail_register_no_approval_required_notify
Thanks for poiting me (us)
Thanks for poiting me (us) this variable, I was hardly looking for a way do disable these email.
Could we put that radio/checkbox into the user_admin_settings form directly ?, by doing
Thanks
This worked perfectly for me.
This worked for me as well.
This worked for me as well. Thanks!
Slight modification for
Slight modification for D7:
Some other variables you can use:
--
wOOge | adrianjean.ca
(now) there's a module for that :)
if someone is still looking for a solution for this issue
you can check the following module:
http://drupal.org/project/mailcontrol
it provides the necessary UI additions for D7 (and D8) to enable site admins to enable/disable any standard Drupal mail
a version for D6 is under development and will soon be available
Drupal Developer @Dropsolid
Mailcontrol worked like a
Mailcontrol worked like a charm.
If you are looking for the configuration it is right with the Drupal user configuration. Great module!
Steve Kessler
You can use this code custom module file
function <MODULENAME>_mail_alter(&$message)
{
if ($message['id'] == 'user_register_no_approval_required') {
$message['send'] = false;
}
}