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/update_option
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/update_option
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’, [ ‘get_callback’ => static function (array $user): string { return get_userdata($user[‘id’])->user_email; }, ] ); Please note, however, that this is strongly discouraged because anyone can then see the … Read more
You want the filters… retrieve_password_message for the actual email content. Your hooked function will get the message as the first argument and the user’s reset key as the second. <?php add_filter(‘retrieve_password_message’, ‘wpse103299_reset_msg’, 10, 2); function wpse103299_reset_msg($message, $reset_key) { // … } retrieve_password_title for the the email subject. <?php add_filter(‘retrieve_password_title’, ‘wpse103299_reset_subject’); function wpse103299_reset_subject($subject) { // … … Read more
you got the first part right about using personal_options_update but to be on the safe side add edit_user_profile_update also. and as for sending emails within WordPress the best way would be to use wp_mail, So something like this: add_action( ‘personal_options_update’, ‘notify_admin_on_update’ ); add_action( ‘edit_user_profile_update’,’notify_admin_on_update’); function notify_admin_on_update(){ global $current_user; get_currentuserinfo(); if (!current_user_can( ‘administrator’ )){// avoid sending … Read more
Basically, you can use JavaScript to post to a WordPress function, then the WordPress function can invoke wp_mail() to send the message. A great place to start would be the useful AJAX in Plugins article on the Codex. It walks you through all the steps required to add your JavaScript on the front-end, your PHP … Read more
You can create custom usermeta for has_logged_in or something like that and then check it when the user logs in to see if it exists and is properly set. If so, no email sent, otherwise, email sent. You could take the opposite approach and create usermeta for not_has_logged_in or something like that and then check … Read more
Twice edited according to kaiser’s suggestions, unsecure version removed. <?php function my_email_friend($post_id = ”) { // get post object $post = get_post($post_id); // get post content $content = $post->post_content; // if @David exists if( 0 !== preg_match(‘/(@\w)/’, $content, $matches) ) $friend_display_name_like=”%” . like_escape($matches[0]) . ‘%’; else return; // do nothing if no matches global $wpdb; … Read more
I had to implement this for a client site and ended up creating my own system. I hash the email and date created timestamp and store it as a key in usermeta, then i email that key to the user’s email in the form of a link. The link points to a page where I’ve … Read more
You can filter the $phpmailer object. Something like this should do the trick (not tested): add_action( ‘phpmailer_init’, ‘wpse_52555_msg_id’ ); function wpse_52555_msg_id( &$phpmailer ) { $msg_id = get_post_meta( get_the_ID(), ‘messageID’, TRUE ); ” !== $msg_id and $phpmailer->MessageID = $msg_id . ‘@test.com’; }
I haven’t used it yet, but you can accomplish this with Jetpack, which is made (at least partially) by the founders of WordPress. The advantage is that it uses the WordPress.com servers to handle the outgoing mail. This is a big plus because shared servers have throttling limits that only allow you to send a … Read more