Sending a Formatted Email after Dynamically replacing text from backend editor created via ACF

Sending a Formatted Email after Dynamically replacing text from backend editor created via ACF
if( substr( get_post_meta($orderid,'plan_type',true) , 0,5) == 'listi') {
    $admin_new_ordermail       = get_field('new_order_template_listing','option');
    $admin_new_ordermail_replace = str_replace(
    array(
        '{orderid}', '{orderdate}','{firstname}','{lastname}','{city}','{state}','{zipcode}','{phonenumber}','{email}','{brokeragename}',
        '{plan}', '{subscription}', '{zipcodetarget}','{listingaddress}','{lisstingcity}', '{listingstate}','{listingzipcode}','{listingprice}', 
        '{listingstatus}','{brokeragenamebannerads}', '{contactphonebannerads}', '{websiteurl}'
        ), 
    array($orderid,$orderdate, $firstname , $lastname, $city, $state, $zipcode, $phonenumber, $email, $brokeragename,    
       $plan, $subscription, $zipcodetarget, $listingaddress, $lisstingcity , $listingstate, $listingzipcode ,$listingprice ,
       $listingstatus, $brokeragenamebannerads, $contactphonebannerads, $websiteurl
    ), 
    $admin_new_ordermail
    );
    $from    = get_field('from_new_order','option');
    $to      = get_field('to_new_order','option');
    $headers[] = 'Content-Type: text/html; charset=UTF-8';
    $headers[] = 'From: DDS <'.$from.'>';
    $headers[] = 'Bcc: Site Manager CC <'.get_field('bcc_new_order','option').'>';
    $mstatus = wp_mail($to,$subject,$admin_new_ordermail_replace, $headers);
    }

screen63

Leave a Reply

Your email address will not be published. Required fields are marked *