本文整理汇总了PHP中Swift_Mime_Message::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Mime_Message::getId方法的具体用法?PHP Swift_Mime_Message::getId怎么用?PHP Swift_Mime_Message::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_Mime_Message
的用法示例。
在下文中一共展示了Swift_Mime_Message::getId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send(\Swift_Mime_Message $message, &$failedRecipients = null)
{
if (!empty(\GO::config()->disable_mail)) {
throw new \Exception("E-mail sending is disabled!");
}
if (\GO::config()->debug) {
$getTo = $message->getTo();
if (!empty($getTo)) {
$getTo = implode(",", array_keys($getTo));
} else {
$getTo = '';
}
\GO::debug("Sending e-mail to " . $getTo);
}
if (\GO::modules()->isInstalled("log")) {
$str = "";
$from = $message->getFrom();
if (!empty($from)) {
$str .= implode(",", array_keys($from));
} else {
$str .= "unknown";
}
$str .= " -> ";
$to = $message->getTo();
if (!empty($to)) {
$str .= implode(",", array_keys($to));
}
$to = $message->getCc();
if (!empty($to)) {
$str .= implode(",", array_keys($to));
}
$to = $message->getBcc();
if (!empty($to)) {
$str .= implode(",", array_keys($to));
}
\GO\Log\Model\Log::create("email", $str);
}
// debug_print_backtrace();
// exit("NO MAIL");
//workaround https://github.com/swiftmailer/swiftmailer/issues/335
$messageId = $message->getId();
$count = parent::send($message, $failedRecipients);
$message->setId($messageId);
// Check if a tmp dir is created to store attachments.
// If so, then remove the tmp dir if the mail is send successfully.
$tmpDir = $message->getTmpDir();
if (!empty($tmpDir)) {
$folder = new \GO\Base\Fs\Folder($tmpDir);
// Check if folder is deleted successfully
if ($folder->delete()) {
\GO::debug('Clear attachments tmp directory: ' . $tmpDir);
} else {
\GO::debug('Failed to clear attachments tmp directory: ' . $tmpDir);
}
}
return $count;
}