I created a operate which I take advantage of to ship an e-mail when a selected button is pressed. This works nice, besides that it all the time leads to spam as an alternative of the inbox.
That is the operate:
operate search_notify_email() {
// Set variables
$e-mail = $_POST['email'];
$title = $_POST['title'];
$content material = $_POST['content'];
$location = $_POST['location'];
$siteurl = $_POST['siteurl'];
$networkurl = network_site_url();
$themeurl = get_stylesheet_directory_uri();
// Name Change E-mail to HTML operate
add_filter( 'wp_mail_content_type', 'set_email_html_content_type' );
$to = $e-mail;
$topic = "Consideration: Check!";
$message = "<html>
<physique>
Testing
</physique>
</html>";
$headers[] = 'From: Instance <noreply@instance.com>';
if ( wp_mail($to, $topic, $message, $headers) ) {
// Success
} else {
// Error
}
die();
// Take away filter HTML content material kind
remove_filter( 'wp_mail_content_type', 'set_email_html_content_type' );
}
add_action('wp_ajax_nopriv_search_notify_email', 'search_notify_email');
add_action('wp_ajax_search_notify_email', 'search_notify_email');
I’ve different emails despatched on my web site with the identical e-mail deal with used and these don’t find yourself within the spam folder.
Any concept why this occurs?