-
Disable Drupal’s default “user X has applied for an account” email
By default Drupal sends an email to the site admin; it’s not editable (and you cannot disable it) from the account settings page.
On a recent project I had to use Rules to send some emails when a user registers for an account. Because I was already sending emails via Rules, I needed to disable the stock admin email. Here’s a quick way to do this:
1234567891011/*** Implements hook_mail_alter().*/function mymodule_mail_alter(&$message) {switch ($message['id']) {case 'user_register_pending_approval_admin':// Don't send the default approval email to the admin (we're using Rules for this)$message ['send'] = FALSE;break;}} -
Sending webform submissions to email based on value of field
We recently did a site for a client that allowed patients to submit a webform to request an appointment. The user could choose their physician and based on their choice, the submission would be emailed to the chosen doctor’s secretary. I originally thought about using the key part of the key|value pair for the select list to store the secretary’s email address, with the doctor’s name. This wouldn’t work, however, because the key could not contain standard email address characters. The solution involved isn’t exactly dynamic, but for a select list that won’t change much (the case here), it’s a fairly elegant solution. Here is the select list and associated code. I created this with the webform UI using a simple select list webform field.