Skip to main content

Disable User Registration Emails

Today I was setting up a shopping cart with Ubercart and Drupal 7 and I noticed that I was getting two registration emails. One from the Drupal user module that said:


Thank you for registering at SITE_NAME. You may now log in by clicking
this link or copying and pasting it to your browser:


This link can only be used once to log in and will lead you to a page where
you can set your password.

After setting your password, you will be able to log in at
http://SITE_URL/user in the future using:

username: USERNAME
password: Your password

--  SITE_NAME team

This was fine except that the order confirmation email that got sent contained the normal order information and the new username / password, which was confusing our users.

An account has been created for you with the following details:
Username: USERNAME
Password: PASSWORD

How to disable the default registration email notification

Here's how to stop the registration email from being sent. Using hook_mail_alter(), we can intercept the message and prevent it from being sent. (

  1. function MYMODULE_mail_alter(&$message){
  2.   if ($message['id'] == 'user_register_no_approval_required') {
  3.     watchdog('My Module Name', 'registration email not sent.');
  4.     $message['send'] = FALSE;
  5.     return;
  6.   }
  7. }