2012-06-05 117 views
0

這裏是我的代碼: -電子郵件會在垃圾郵件中的蛋糕PHP

//Sending mail 
if ($this->Session->read('Enrollment.personalinfo_language') == 'English') { 
    $language = "english"; 
    $subject = "Thank you for submitting your enrollment request to Apna Energy."; 
} else { 
    $language = "spanish"; 
    $subject = "Gracias por enviar su solicitud de inscripci?n a Apna Energy."; 
} 
$details = $this->Session->read('Enrollment'); 
$details['plan_name'] = $product['Product']['name']; 
$details['rate'] = $plan_rate; 
$details['term'] = $product['Term']['term']; 
$this->Email->sendAs = 'html'; 
$this->Email->from = 'Apna Energy <[email protected]>'; 
$this->Email->to = $this->Session->read('Enrollment.personalinfo_first_name') . ' ' . $this->Session->read('Enrollment.personalinfo_last_name') . '<' . $this->Session->read('Enrollment.personalinfo_email') . '>'; 
$this->Email->bcc = array('[email protected]'); 
$this->Email->subject = $subject; 
$this->set('details', $details); 
if ($this->Session->read('Enrollment.personalinfo_language') == 'English') { 
    $template = "enrollment_confirmation"; 
} else { 
    $template = "enrollment_confirmation"; 
} 
$this->Email->template = $template; 
$this->Email->send(); 

我的問題是,如果他們是在「到」接受他/她的垃圾郵件文件夾..客戶的郵件ID的郵件客戶填表..和我的郵件編號在「BCC」我的郵件來了罰款,我的收件箱文件夾..

我順着兩個URL,但他們並沒有爲我工作了..

Cakephp emails going to spam

How do you make sure email you send programmatically is not automatically marked as spam?

引導我在正確的方向.. 謝謝!!

+0

請格式化您的問題以使其可讀。 –

+0

我已經形成了清晰的代碼.. –

回答

1

使用SMTP

與正常PHP服務器必須正確配置,這是不容易做到,因爲一個初學者(MX記錄需要的服務器IP等相匹配)。 所以,只要始終堅持SMTP作爲郵件網關,你會沒事的。 PS:我不認爲它和你的代碼有什麼關係,儘管它不是很漂亮。例如:您應該投射從會話中讀取的數組以避免發出通知:

$details = (array)$this->Session->read('Enrollment'); 
+0

那麼,該怎麼辦? –

+0

好吧,我正在嘗試... –

+0

不適合我...再次郵件發送到垃圾郵件文件夾的「到」.. –

相關問題