In Drupal 7, it's quite easy to change the body of the emails here:


However, it has no place to set the "from" email address. I'm getting lots of spam signups and want the from email address to be "[email protected]", so as to make any responses get disgarded.

Any idea how to do this? Or even what email address is set for these emails?

2 Answers 2


You can use hook_mail_alter() to change the "from" email address of any email sent out from your site. Your code would look something like...

function yourmodule_mail_alter(&$message) {
  $message['from'] = $message['headers']['From'] = '"Full Name" <[email protected]>';

Also, keep in mind that just setting the "from" address may not have the desired results in all email clients (see the discussion on the Drupal issue queue). You might also need to set "sender", "errors-to" and "reply-to" based on your requirements. Those values are in the "header" of the $message variable from the code sample above.


First off... if you haven't already, take a look at:

captcha and reCaptcha

A CAPTCHA is a challenge-response test most often placed within web forms to determine whether the user is human. The purpose of CAPTCHA is to block form submissions by spambots, which are automated scripts that post spam content everywhere they can. The CAPTCHA module provides this feature to virtually any user facing web form on a Drupal site.

Uses the reCAPTCHA web service to improve the CAPTCHA system and protect email addresses.

plus a dozen or more other spam protection modules. I found these are very effective at elminating the bots.

Also, take a look at User IP Log

User IP Log is a simple module that logs the IP address of users on login event to table {uiplog}.

with this you can block the ip addresses of known spammers - it takes some time but in the long run has a profound effect.

You could also set the default email address for the site to [email protected] which will make all system emails appear from that address, and then use something like Contact Forms which if memory serves will allow you to set the sender address for different contact forms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.