Send custom email template in wordpress
$body = file_get_contents(WP_CONTENT_DIR . '/themes/Avada-Child-Theme/contact-email.html');
$body = str_replace("#name#",$_POST['quotename'],$body);
$body = str_replace("#email#",'<a style="color:#fff" href="mailto:'.$_POST['quoteemail'].'">'.$_POST['quoteemail'].'</a>',$body);
$body = str_replace("#mobile#",$_POST['quotemobile'],$body);
$body = str_replace("#message#",$_POST['quotemessage'],$body);
$toadmin = "Scott@USAPrivateMoney.com, Jack@USAPrivateMoney.com, Prospect.60008.140@realtyjuggler.com";
$adminmessage = "You just got one more visitor that is ".$quoteemail." who filled proof of funds letter. Please find the attachment";
$headers = 'From: "' . $quotename . '" <no-reply@usaprivatemoney.com>' . "\r\n";
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
mail( $toadmin, $quotename, $body, $headers );
Example
if($product_id === 6112) {
$customername = $order->get_billing_first_name() .' '.$order->get_billing_last_name();
$message = file_get_contents(WP_CONTENT_DIR . '/themes/twentynineteen-child/emails/premiumsupport.html');
$message = str_replace("{customeremail}",$customername,$message);
$toadmin = $order->get_billing_email();
$quotename = "Let Us Structure Your Partnership";
$headers = 'From: "' . $quotename . '" <no-reply@brrrrinvest.com>' . "\r\n";
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
wp_mail( $toadmin, $quotename, $message, $headers );
}
Comments
Post a Comment