本文整理汇总了PHP中EmailMessage::getRecipientCount方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailMessage::getRecipientCount方法的具体用法?PHP EmailMessage::getRecipientCount怎么用?PHP EmailMessage::getRecipientCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailMessage
的用法示例。
在下文中一共展示了EmailMessage::getRecipientCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Sends a single email.
* @param EmailMessage $model the model instance.
* @return integer the number of recipients.
*/
public function send(EmailMessage $model)
{
if ($this->logging) {
$this->log(__CLASS__ . '.' . __FUNCTION__ . ':' . $model);
}
if (!$this->allowEmail($model->to)) {
return -1;
// not allowed to send
}
if ($this->dryRun) {
return $model->getRecipientCount();
}
// Get the Swift_Message
$message = $model->getMessage();
if (isset($this->catchAllEmail)) {
$message->setTo($this->catchAllEmail);
$model->to = $this->catchAllEmail;
$cc = $message->getCc();
if (!empty($cc)) {
$message->setCc($this->catchAllEmail);
$model->cc = $this->catchAllEmail;
} else {
$model->cc = null;
}
$bcc = $message->getBcc();
if (!empty($bcc)) {
$message->setBcc($this->catchAllEmail);
$model->bcc = $this->catchAllEmail;
} else {
$model->bcc = null;
}
}
$recipientCount = $this->getMailer()->send($message, $this->_failedRecipients);
$model->sentTime = date('Y-m-d H:i:s');
$model->save(false);
return $recipientCount;
}