php - Having trouble sending an email to Cc using wp_mail() in Wordpress -
i able send email no issues, email not being cc'd after inputting in headers argument. missing in code below?
$to = 'myemail@example.com'; $subject = 'this email came site!'; $headers = array( 'content-type: text/html', 'cc: otheremail@example.com', ); $body = $_post['message']; $response = wp_mail( $to, $subject, $body, $headers );
so issue needed add cc email in array in format
alias name <otheremail@example.com>
instead of email
otheremail@example.com
.
now, email being cc'd properly.
complete working sample.
$to = 'myemail@example.com'; $subject = 'this email came site!'; $headers = array( 'content-type: text/html', 'cc: alias name <otheremail@example.com>', ); $body = $_post['message']; $response = wp_mail( $to, $subject, $body, $headers );
Comments
Post a Comment