39 votes

How to change the default registration email ? (plugin and/or non-plugin)

For 2018 and onwards users: Since WordPress 4.9.0 there are new filters you can use for this (no need for a plugin anymore): wp_new_user_notification_email - customise email sent to User ...
Edu Wass's user avatar
  • 701
33 votes

Disable email notification after change of password

To disable Admin email notification when a user resets their own password, create a Plugin (or Must Use Plugin) using the following code snippet: /** * Disable Admin Notification of User Password ...
rjb's user avatar
  • 1,377
21 votes

How can i change email template for new user

For 2018 and onwards users: David Gard's answer still works but is old and there's a new better/cleaner way to do this (no need for a plugin anymore). Since WordPress 4.9.0 there are new filters you ...
Edu Wass's user avatar
  • 701
15 votes

How to disable all WordPress emails modularly and programatically?

Option 1: Remove the 'to' argument from wp_mail function in WordPress, it will keep your system running without sending any default WordPress emails. add_filter('wp_mail','disabling_emails', 10,1); ...
kirillrocks's user avatar
13 votes

Include HTML template file in wp_mail

Here is the sample code for using output buffering. You will be able to access all the variables inside the template which are defined above "include line". WordPress: Include template in the email....
Mayur Chauhan's user avatar
12 votes
Accepted

How to set up User email verification after Signup?

You can use user_register hook add_action( 'user_register', 'my_registration', 10, 2 ); function my_registration( $user_id ) { // get user data $user_info = get_userdata($user_id); // ...
Akshat's user avatar
  • 1,197
11 votes

Sending multipart (text/html) emails via wp_mail() will likely get your domain banned

TLDR, the simple solution is: add_action('phpmailer_init','wp_mail_set_text_body'); function wp_mail_set_text_body($phpmailer) { if (empty($phpmailer->AltBody)) {$phpmailer->AltBody = ...
majick's user avatar
  • 5,081
10 votes

How to change the email notification recipient (user) for new comments?

There's a great article explaining how to hook into 2 filters for this at https://web.archive.org/web/20200216075253/http://www.sourcexpress.com/customize-wordpress-comment-notification-emails/ To ...
Andy Macaulay-Brook's user avatar
10 votes
Accepted

Missing URL in password reset email

The problem is the < and > which surround the reset URL in wp-login.php. You can remove them using retrieve_password_message in your theme functions.php file like below: add_filter("...
Luke Seall's user avatar
10 votes

How can I modify the default reset (lost) password email text?

To answer your specific question, "How can I modify the default reset (lost) password email text," the answer would be to use the retrieve_password_message filter. And ultimately that might be a way ...
butlerblog's user avatar
  • 4,986
9 votes

How to set SMTP programmatically

The other answers to this post, while providing a working solution, don't address the security issue of storing your SMTP credentials in a plugin file or functions.php. In some cases that may be OK, ...
butlerblog's user avatar
  • 4,986
7 votes

Reset Password - change from name and email address

Use the following code in your active theme's functions.php file. No need to hard code your email address and blog name, this gets both as given in WordPress Settings > General. add_filter( '...
mohamed arshath's user avatar
7 votes
Accepted

How to add headers to outgoing email?

Thanks to the above, I've realized my central mistake -- I didn't quite realize that the arguments being passed in were a multi-dimensional array. For now, I've re-implemented the function thus: ...
David E. Smith's user avatar
7 votes
Accepted

Send activation email to user after signup

For activation process you can follow following steps: As you can see user_activation_key column in wp_users table. You can make use of that column for sending user activation link. While signing up ...
Alok Shrestha's user avatar
7 votes

Should I use wp_mail or PHP's mail?

WordPress offers its own mailing system. I suggest you use that instead of PHP's native mail. wp_mail accepts five arguments: wp_mail( $to, $subject, $message, $headers, $attachments ); So your ...
Johansson's user avatar
  • 15.3k
7 votes
Accepted

How do i send mail with custom Form Data using WordPress

wp_mail is the function you are looking for. You can take the posted form data ($_POST['email'], for example) and then use it to build and execute the wp_mail function. The example below was taken ...
Tom's user avatar
  • 1,286
7 votes

How to disable automated E-Mail on PHP error/exception?

I have thoroughly tested the above suggestions and neither of them work. The only thing I have found that DOES work is adding the following to "wp-config.php": define('WP_DISABLE_FATAL_ERROR_HANDLER'...
Graphic Detail's user avatar
6 votes

User Without Email?

Using Wordpress 4.7.2, I solved this with the following hooks: // This will suppress empty email errors when submitting the user form add_action('user_profile_update_errors', '...
CGodo's user avatar
  • 181
6 votes

prevent users from changing their email address

The only correct solution (Other answers I see are faulty, vulnerable or incomplete. All of them can be bypassed.) This plugin does correctly: class DisableMailChange { public function ...
T.Todua's user avatar
  • 5,789
6 votes

Send Admin Emails to Multiple Email Addresses

This can be done by filtering the wp_mail function, checking if to is set to the admin email, and if so, add your additional emails addresses, and return args back to wp_mail add_filter( 'wp_mail', '...
sMyles's user avatar
  • 2,836
6 votes

How can I change the email sender name from wordpress to (myblogname) on the "lost password" email?

If you have a custom login page already, you may not want to introduce a whole new plugin. You can change 'from' name and email with these simple functions in your theme or plugin. To change the name ...
Jeremy Ross's user avatar
6 votes

How to add headers to outgoing email?

Here's an alternative using directly the AddCustomHeader method of the PHPMailer instance: /** * Add a custom header. * $name value can be overloaded to contain * both header name and value (name:...
birgire's user avatar
  • 67.1k
6 votes

How can 'admin_email' be set?

In Wordpress backend go to: Settings > General and the field 'Email Address'. Or in php: update_option('admin_email', '[email protected]'); https://codex.wordpress.org/Function_Reference/...
ngearing's user avatar
  • 2,134
6 votes

WooCommerce: Email Notifications

You may be using the wrong hook. I use this : add_action( "woocommerce_email_after_order_table", "custom_woocommerce_email_after_order_table", 10, 1); function ...
rudtek's user avatar
  • 6,121
6 votes
Accepted

How to disable automated E-Mail on PHP error/exception?

There was some discussion on it a few weeks ago you can find here: https://make.wordpress.org/core/2019/04/16/fatal-error-recovery-mode-in-5-2/ According to that and looking through the core, you can ...
ChristopherJones's user avatar
5 votes

Sending multipart (text/html) emails via wp_mail() will likely get your domain banned

For anyone that's using the phpmailer_init hook to add their own 'AltBody': The alternative text body is reused for different consecutive mails being sent, unless you clear it manually! WordPress ...
Tanuki's user avatar
  • 53
5 votes
Accepted

How can I get users email (and additional data) from the rest API?

To add the user's email address in the REST API response, register an additional field to the user object and add the email address: register_rest_field( 'user', 'user_email', [ '...
Mostafa Soufi's user avatar
5 votes

Customize wp_new_user_notification_email()

You need to use the get_password_reset_key function (see reference) which will query the database and return the reset password key of the user. Here's a full working example: add_filter( '...
Dimitris Siakavelis's user avatar
5 votes

How to get current post ID in Contact Form 7 wpcf7_before_send_mail hook action

You can get the post ID from array variable $posted_data the form was send from if ($submission) { $posted_data = $submission->get_posted_data(); print_r($posted_data) } if you ...
Awais's user avatar
  • 348

Only top scored, non community-wiki answers of a minimum length are eligible