2017-08-18 53 views
0

我能夠發送沒有問題的郵件,但即使在標題參數中輸入此郵件,郵件也沒有被CC's。我在下面的代碼中丟失了什麼?在Wordpress中使用wp_mail()發送郵件給Cc時遇到問題

$to = '[email protected]'; 

$subject = 'This email came from the site!'; 

$headers = array(
    'Content-type: text/html', 
    'Cc: [email protected]', 
); 

$body = $_POST['message']; 
$response = wp_mail($to, $subject, $body, $headers); 
+0

請訪問這裏[https://stackoverflow.com/questions/30098670/sending-emails-with-bcc-and-cc-with-wp-mail](https://stackoverflow.com/questions/30098670 /送電子郵件與 - BCC-和-CC-與-WP-郵件) –

回答

0

所以,問題是,我需要添加在我的數組,並抄送電子郵件這種格式

Alias Name <[email protected]>

而不僅僅是電子郵件

[email protected]的。

現在,電子郵件正在被cc'd正確。

完整的工作示例。

$to = '[email protected]'; 

$subject = 'This email came from the site!'; 

$headers = array(
    'Content-type: text/html', 
    'Cc: Alias Name <[email protected]>', 
); 

$body = $_POST['message']; 
$response = wp_mail($to, $subject, $body, $headers); 
相關問題