wp_mail not sending
So I have a localhost WordPress server, and the function wp_mail workd perfectly and sends. When I put the exact same file in an actual WordPress website as a theme, it only shows me a blank screen, and doesn't send anything. Code:
?php
if (isset($_POST['submit'])) {
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$company = $_POST['company'];
$to = "[email protected]";
function wpse27856_set_content_type(){
return "text/html";
}
add_filter( 'wp_mail_content_type','wpse27856_set_content_type' );
$msg = 'htmlbodyh1Contact Service/h1table rules="all" style="border-color: #666;" cellpadding="10"tr style="background: #E3E8EC;"tdstrongFirst Name:/strong /tdtd' . strip_tags($_POST['first_name']) . '/td/trtrtdstrongLast Name:/strong /tdtd' . strip_tags($_POST['last_name']) . '/td/trtrtdstrongEmail:/strong /tdtd' . strip_tags($_POST['email']) . '/td/trtrtdstrongCompany:/strong /tdtd' . strip_tags($_POST['company']) . '/td/trtrtdstrongMessage:/strong /tdtd' . strip_tags($_POST['message']) . '/td/tr/body/html';
wp_mail( $to, $subject, $msg );
?
This is followed by a form where you input everything. Any help would be appreciated :)
Topic html-email wp-mail php Wordpress
Category Web