<?php QEmailServer::$SmtpServer = SMTP_SERVER; QEmailServer::$OriginatingServerIp = SMTP_EHLO; QEmailServer::$TestMode = SMTP_TEST_MODE; $objEmailQueue = EmailQueue::QueryArray(QQ::IsNull(QQN::EmailQueue()->ErrorFlag), QQ::Clause(QQ::OrderBy(QQN::EmailQueue()->HighPriorityFlag, false), QQ::LimitInfo(50))); foreach ($objEmailQueue as $objEmail) { $objEmail->Send(); }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a EmailQueue-based QQNode. * It will also verify that it is a proper EmailQueue-based QQNode, and will throw an exception otherwise. * * @param mixed $mixContent * @return QQNode */ protected function ResolveContentItem($mixContent) { if ($mixContent instanceof QQNode) { if (!$mixContent->_ParentNode) { throw new QCallerException('Content QQNode cannot be a Top Level Node'); } if ($mixContent->_RootTableName == 'email_queue') { if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } $objCurrentNode = $mixContent; while ($objCurrentNode = $objCurrentNode->_ParentNode) { if (!$objCurrentNode instanceof QQNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } } return $mixContent; } else { throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "email_queue".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'Id': return QQN::EmailQueue()->Id; case 'ToAddress': return QQN::EmailQueue()->ToAddress; case 'FromAddress': return QQN::EmailQueue()->FromAddress; case 'Subject': return QQN::EmailQueue()->Subject; case 'Body': return QQN::EmailQueue()->Body; case 'Html': return QQN::EmailQueue()->Html; case 'HighPriorityFlag': return QQN::EmailQueue()->HighPriorityFlag; case 'ErrorFlag': return QQN::EmailQueue()->ErrorFlag; case 'ErrorMessage': return QQN::EmailQueue()->ErrorMessage; default: throw new QCallerException('Simple Property not found in EmailQueueDataGrid content: ' . $mixContent); } } else { if ($mixContent instanceof QQAssociationNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } else { throw new QCallerException('Invalid Content type'); } } } }
/** * Count EmailQueues * by ErrorFlag Index(es) * @param boolean $blnErrorFlag * @return int */ public static function CountByErrorFlag($blnErrorFlag) { // Call EmailQueue::QueryCount to perform the CountByErrorFlag query return EmailQueue::QueryCount(QQ::Equal(QQN::EmailQueue()->ErrorFlag, $blnErrorFlag)); }
<?php QEmailServer::$SmtpServer = SMTP_SERVER; QEmailServer::$SmtpPort = SMTP_PORT; QEmailServer::$SmtpUsername = SMTP_USERNAME; QEmailServer::$SmtpPassword = SMTP_PASSWORD; QEmailServer::$AuthLogin = true; $objEmailQueue = EmailQueue::QueryArray(QQ::IsNull(QQN::EmailQueue()->ErrorFlag), QQ::Clause(QQ::LimitInfo(50))); foreach ($objEmailQueue as $objEmail) { $objEmail->Send(); }
/** * Load a single EmailQueue object, * by EmailQueueId Index(es) * @param integer $intEmailQueueId * @return EmailQueue */ public static function LoadByEmailQueueId($intEmailQueueId, $objOptionalClauses = null) { return EmailQueue::QuerySingle(QQ::Equal(QQN::EmailQueue()->EmailQueueId, $intEmailQueueId), $objOptionalClauses); }