wp_mail recipient array not sending?

There are multiple ways of doing this. You can consider any of the following. 1.My preferred: foreach($group_emails as $email_address) { wp_mail($email_address, ‘my subject’, ‘my message’, $headers); } 2.Another way Define the array as follows. $group_emails = array(‘[email protected]’, ‘[email protected]’, ‘[email protected]’, ‘[email protected]’, ‘[email protected]’, ‘[email protected]’, ‘[email protected]’, ‘[email protected]’, ‘[email protected]’, ‘[email protected]’ ); And then try your regular procedure: wp_mail($group_emails, ‘my … Read more

Few chars getting replaced with ‘=’ in mail content in wp_mail()

Commenting couple of return statements and replacing them as suggested in the below link on wordpress.org worked for me, now the mails are sent properly and the equal sign ‘=’ issue is solved. Fixed by making following changes in wp-includes\class-phpmailer.php public function encodeQP($string, $line_max = 76) { // Use native function if it’s available (>= … Read more

How to auto send email when publishing a custom post type?

Hook into transition_post_status, fetch the users and send an email to all users. Sample code, not tested: add_action( ‘transition_post_status’, ‘send_mails_on_publish’, 10, 3 ); function send_mails_on_publish( $new_status, $old_status, $post ) { if ( ‘publish’ !== $new_status or ‘publish’ === $old_status or ‘my_custom_type’ !== get_post_type( $post ) ) return; $subscribers = get_users( array ( ‘role’ => ‘subscriber’ … Read more

Buddypress send email notification only if user is not logged in [closed]

One thing you can do is to filter $email_to and return empty string if the recipient is logged in. This way wp_mail() will fail to send the message and return false. Add the following to theme functions.php or to bp-custom.php file: add_filter(‘messages_notification_new_message_to’, ‘disable_loggedin_email_notification’); function disable_loggedin_email_notification($email_to) { $user = get_user_by(’email’,$email_to); if (bp_has_members(“type=online&include=$user->ID”)) { $email_to = ”; … Read more

WP Cron emails not working

This should be a comment, but I don’t have comment privelages 🙁 I had this exact problem not long ago, and felt stupid when I realised it was because I had set a password on the directory…

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