18 January 2020

How to send custom email template in wordpress?

 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 );
}

No comments:

Post a Comment

How to create youtube videos slider with play and pause option in wordpress?

Create youtube videos slider with play and pause option in wordpress youtube videos slider Use this shortcode:- [punjab_today] function my_...