Filter wp_mail based on content type

Note that the wp_mail filter runs before the wp_mail_content_type filter. If you’re using the PHP Mailer then you can try (untested): add_action( ‘phpmailer_init’, function( $phpmailer ) { if( ‘text/plain’ === $phpmailer->ContentType ) { $phpmailer->Body = ‘Filtered text here’; // <– Message override } });

wp_mail() not sending emails with ajax

And there is no way it will work this way… In your JS you fill your data like so: var data = { ‘action’:’send_confirmation_email’, ’email’:’confirm_email’, ‘key’:’confirm_key’, ‘name’:’display_name’, ‘id’:’user_id’, ‘is_email’:’true’ }; And later, in your AJAX callback in PHP you use it as follows: wp_mail( $_REQUEST[’email’], $subject, $message, $headers ); So you’re trying to send email … Read more

wp_mail doesnt work inside transition_comment_status

* UPDATE * I have placed this function before the prev code // define the wp_mail_failed callback function action_wp_mail_failed($wp_error) { return error_log(print_r($wp_error, true)); } // add the action add_action(‘wp_mail_failed’, ‘action_wp_mail_failed’, 10, 1); Which helped me track the problem (using headers wrong). I share this in the hopes this helpes anyone while debugging wp_mail()

How to send the checkbox value to email

First you need to add a class for all checkbox as having same id for multiple items is not recommended <input type=”checkbox” class=”new_class” id=’haet_mail_test_address’ name=”ckboxs[]” value=””.$emails[$i][“user_email’].”‘> Now we to change the way you are getting the values from checkbox Change var checkbox = $(‘#haet_mail_test_address’).val(); To var checkbox = $(“.new_class:checkbox:checked”).map(function(){ return $(this).val(); }).get(); console.log(checkbox); // check … Read more

Different query result on local and server

Can you try using another date format? Example: foreach ($blogs AS $blog) { switch_to_blog($blog[“blog_id”]); $yesterday_today = array( ‘order’ => ‘ASC’, ‘orderby’ => ‘date’, ‘date_query’ => array( array( ‘after’ => array( ‘year’ => date(‘Y’,strtotime(“-1 days”)), ‘month’ => date(‘n’,strtotime(“-1 days”)), ‘day’ => date(‘j’,strtotime(“-1 days”)), ), ‘before’ => array( ‘year’ => date(‘Y’), ‘month’ => date(‘n’), ‘day’ => date(‘j’), … Read more

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