wp_mail and BCC headers

You could try to debug the output like this: function test_phpmailer_init( $phpmailer ) { echo ‘<pre>’; var_dump( $phpmailer ); echo ‘</pre>’; return $phpmailer; } add_action( ‘phpmailer_init’, ‘test_phpmailer_init’ ); The code in your question is correct, the problem is with your local SMTP application. If you are using a local SMTP server (e.x. Papercut), it only … Read more

Subscribe to email for security fixes?

There is a plug-in that will send you an email whenever an update becomes available (security updates and otherwise). This will be one of the easiest ways to get notified via email: Update Notifier Alternatively, there are usually emails on the WP-Testers email list immediately following an update. You can always subscribe to that to … Read more

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 send your notifications to a particular user and not the site admin, try this for a user with ID 123: function se_comment_moderation_recipients( $emails, $comment_id ) { $comment = get_comment( $comment_id ); $post = get_post( $comment->comment_post_ID ); $user = get_user_by( … Read more

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 __construct() { //prevent email change add_action( ‘personal_options_update’, [$this, ‘disable_mail_change_BACKEND’], 5 ); add_action( ‘show_user_profile’, [$this, ‘disable_mail_change_HTML’] ); } public function disable_mail_change_BACKEND($user_id) { if ( !current_user_can( ‘manage_options’ ) ) … Read more

Email user when password is reset by admin

Here’s one way to add this feature using the following flowline : The admin updates the user option page: -> edit_user_profile_update or personal_options_update hooks activated -> edit_user() function is called -> wp_update_user() function is called within edit_user() -> wp_insert_user() function is called within wp_update_user() -> profile_update hook activated within wp_insert_user() for user updates, not user … Read more

“Reply-to Address” Email

If and when you are using wp_mail(), then you can just set Reply-To for the $headers parameter. Exemplary usage below: $to = “[email protected]”; $subject = “Using Reply-To with wp_mail”; $message = “This is an example for using Reply-To with wp_mail.”; $headers[] = ‘Reply-To: Name Name <[email protected]>’; $attachments = array(); wp_mail( $to, $subject, $message, $headers, $attachments … Read more

Check if post is being published for the first time, or is an already published post being updated

Hook into edit_post to catch changes. And take a look at wp_transition_post_status() which is called on inserts and updates: function wp_transition_post_status($new_status, $old_status, $post) { do_action(‘transition_post_status’, $new_status, $old_status, $post); do_action(“{$old_status}_to_{$new_status}”, $post); do_action(“{$new_status}_{$post->post_type}”, $post->ID, $post); } On publish you hook into draft_to_publish, pending_to_publish and auto-draft_to_publish. For edits hook into publish_to_publish. Example A mini plugin that notifies all … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)