我不熟悉wp代码有人能告诉我如何执行SQL查询然后触发邮件吗?
我的目标是在确认查询后首先向表格执行查询SELECT * FROM mytable
我想触发wp_mail
。
这是对的吗?
add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
$email_result = wp_mail('my.email@domain.com', 'Subject', 'Message');
if( $email_result ){//wp_mail() processed the request successfully
global $wpdb;
$table_name = $wpdb->prefix . "mytable";
$ereminders = $wpdb->query( $wpdb->prepare("
SELECT * FROM $table_name
") );
}