0
我想發郵件給不同的用戶喜歡我用 問題的電子郵件是,它需要很長的時間循環發送郵件的CakePHP
foreach($users as $user){
$this->Email->smtpOptions = array(
'port' => '25',
'timeout' => '30',
'host' => 'smtp.topnet.tn',
);
Envoie Mail
$this->Email->delivery = 'smtp';
$this->Email->reset();
$this->Email->from = $from;
$this->Email->to = $To;
$this->Email->subject = $subject;
$this->set('id_user',$user_id);
$this->set('password',$pass);
$this->Email->template = 'activcompte';
$this->Email->sendAs = 'both';
$this->Email->send();
}
請記住,如果你要發送到> 1000個用戶,你可能想在http://stackoverflow.com/questions/3905734/how-to-send-100-000-emails-weekly閱讀了郵件羣發是一個不平凡的業務最好留給專業人士 – 2012-08-02 18:04:02
你可以嘗試爲它設置一個cron。每當你的服務器空閒時,請設定時間運行上面的代碼。 – 2012-08-06 04:41:05