本文整理汇总了PHP中Mailer::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::instance方法的具体用法?PHP Mailer::instance怎么用?PHP Mailer::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::instance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* @return Mailer
*/
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
示例2: getInstance
public static function getInstance($subject = "")
{
if (self::$instance === false) {
self::$instance = new Mailer($subject);
}
return self::$instance;
}
示例3: instance
/**
* Mailer::instance()
*
* @return
*/
public static function instance()
{
if (!self::$instance) {
self::$instance = new Mailer();
}
return self::$instance;
}
示例4: actionRunat
public function actionRunat()
{
//首先,找出当前时间之前的没有运行的at任务
$ats = AtModel::instance()->getShouldRun();
foreach ($ats as $at) {
if (Mailer::instance()->sendMail($at['title'], $at['content'], $at['email'])) {
AtModel::instance()->update($at['id'], array('hasrun' => 1));
}
}
}
示例5: actionRuncron
public function actionRuncron()
{
$todayDay = date('Y-m-d');
$crons = CronModel::instance()->getShowRun();
foreach ($crons as $cron) {
if (Mailer::instance()->sendMail($cron['title'], $cron['content'], $cron['email'])) {
CronModel::instance()->update($cron['id'], array('last_run_date' => $todayDay));
}
}
}
示例6: send
protected function send()
{
$mailer = Mailer::instance();
$mailer->service->setSubject($this->subject)->setFrom($this->sender)->setBody(nl2br($this->message, false))->setAttachments($this->attachments);
if ($this->useBcc == true) {
$mailer->service->setBcc($this->recipient);
} else {
$mailer->service->setTo($this->recipient);
}
$this->reset();
$mailer->service->send();
}
示例7: create
public static function create()
{
$args = func_get_args();
if (empty($args)) {
throw new Exception('Mailer : mail method required.');
// pas top comme msg
}
$methodName = $args[0];
unset($args[0]);
// PHP5 ne gère pas bien l'héritage de fonctions statiques, aussi sommes-nous
// obligés de préciser que nous voulons instancier la classe ApplicationMailer.
// Cela contraint l'user à nommer sa classe ApplicationMailer...
if (self::$instance == null) {
self::$instance = new ApplicationMailer($methodName);
}
// appel de la méthode définie par l'user
call_user_func_array(array(self::$instance, $methodName), $args);
if (!is_string(self::$instance->body)) {
}
}
示例8: sendMail
public static function sendMail($subject = '', $body = '', $to = array(), $cc = array(), $bcc = array(), $att = array())
{
try {
self::$instance = new Mailer();
self::$instance->addSubject($subject);
self::$instance->addBody($body);
self::$instance->addTo($to);
if (!empty($cc)) {
self::$instance->addCopy($cc);
}
if (!empty($bcc)) {
self::$instance->addBackCopy($bcc);
}
if (!empty($att)) {
self::$instance->addAttach($att);
}
return self::$instance->send();
} catch (phpmailerException $e) {
self::throwMailerException($e->getMessage());
return false;
}
}