Example #1
0
            if (strpos($strResponse, "250") === false || strpos($strResponse, "250") != 0) {
                throw new QEmailException(sprintf('Error Response on MAIL FROM: %s', $strResponse));
            }
        }
        // Send: QUIT
        fwrite($objResource, "QUIT\r\n");
        if (!feof($objResource)) {
            $strResponse = fgets($objResource, 4096);
        }
        // Close the Resource
        fclose($objResource);
    }
}
// PHP does not allow Static Class Variables to be set to non-constants.
// So we set QEmailServer's OriginatingServerIp to QApplication's ServerAddress here.
QEmailServer::$OriginatingServerIp = QApplication::$ServerAddress;
class QEmailException extends QCallerException
{
}
class QEmailAttachment extends QBaseClass
{
    protected $strFilePath;
    protected $strMimeType;
    protected $strFileName;
    protected $strEncodedFileData;
    public function __construct($strFilePath, $strSpecifiedMimeType = null, $strSpecifiedFileName = null)
    {
        // Set File Path
        if (!is_file(realpath($strFilePath))) {
            throw new QCallerException('File Not Found: ' . $strFilePath);
        }
<?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();
}