本文整理匯總了PHP中Illuminate\Mail\Mailer::sendSwiftMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mailer::sendSwiftMessage方法的具體用法?PHP Mailer::sendSwiftMessage怎麽用?PHP Mailer::sendSwiftMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Mail\Mailer
的用法示例。
在下文中一共展示了Mailer::sendSwiftMessage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendSwiftMessage
/**
* Send a Swift Message instance.
*
* @param \Swift_Message $message
* @return int
*/
protected function sendSwiftMessage($message)
{
$from = $message->getFrom();
if (empty($from)) {
list($sender_addr, $sender_name) = $this->sender_addr;
empty($sender_addr) or $message->setFrom($sender_addr, $sender_name);
}
list($log_addr, $log_name) = $this->log_addr;
empty($log_addr) or $message->setBcc($log_addr, $log_name);
$to = $message->getTo();
empty($to) or $to = key($to);
/*
* Set custom headers for tracking
*/
$headers = $message->getHeaders();
$headers->addTextHeader('X-Site-ID', $this->x_site_id);
$headers->addTextHeader('X-User-ID', base64_encode($to));
/*
* Set to address based on environment
*/
if (strcasecmp($this->environment, 'production') != 0) {
list($dev_addr, $dev_name) = $this->developer_addr;
$message->setTo($dev_addr, $dev_name);
}
/*
* Set return path.
*/
if ($this->return_path) {
$return_path = $this->generateReturnPathEmail(key($message->getTo()));
$message->setReturnPath($return_path);
}
parent::sendSwiftMessage($message);
}