Change wordpress registration email

The following code allows you to change the default email that wordpress sends after user registers on the website. You can modiy the default email and add your own custom email message and email subject.

The code:

<?php
/** 
* http://webdeveloperswall.com/wordpress/change-wordpress-registration-email 
*Add filter for registration email subject and message
**/
add_filter('wp_mail','my_custom_registration_mail');

function my_custom_registration_mail($email) {
    if (isset ($email['subject']) && substr_count($email['subject'],'Your username and password')>0 ) {
	if (isset($email['message'])) {

		$messg = "Hello,\r\nWe have received your sign-up request on our website. Your details are as follows:\r\n \r\n";
		$messg .= $email['message'];
		$messg .= "You can now login at the link given.\r\n \r\nWe look forward to your active participation on our website. \r\n \r\nkind regds,\r\nWebMaster \r\nYourDomain.com";
		$email['message'] = $messg;
		$email['subject'] = "YourDomain.com - New Member Sign-up.";
	}
    }
    return ($email);
}
?>

What to do with the code ?
Just add the code inside functions.php file of your current theme. And dont forget to change ‘YourDomain.com’ to something useful 🙂

That’s it here. Hope you find it useful.

Published by

Chandan Chaudhary

Chandan is a WordPress guy. A programmer at heart. He loves building community sites with WordPress and BuddyPress.

2 thoughts on “Change wordpress registration email”

Leave a Reply

Your email address will not be published. Required fields are marked *