本文整理汇总了PHP中Billrun_Factory::mailer方法的典型用法代码示例。如果您正苦于以下问题:PHP Billrun_Factory::mailer方法的具体用法?PHP Billrun_Factory::mailer怎么用?PHP Billrun_Factory::mailer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Billrun_Factory
的用法示例。
在下文中一共展示了Billrun_Factory::mailer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mailer
/**
* method to retrieve the a mailer instance
*
* @return Billrun_Db
*/
public static function mailer()
{
if (!isset(self::$mailer)) {
try {
self::$mailer = new Zend_Mail();
//TODO set common configuration.
$fromName = Billrun_Factory::config()->getConfigValue('mailer.from.address', 'no-reply');
$fromAddress = Billrun_Factory::config()->getConfigValue('mailer.from.name', 'Billrun');
self::$mailer->setFrom($fromName, $fromAddress);
//$mail->setDefaultTransport($transport);
} catch (Exception $e) {
self::log("Can't instantiat mail object. Please check your settings", Zend_Log::ALERT);
return false;
}
}
return self::$mailer;
}
示例2: sendMail
public static function sendMail($subject, $body, $recipients, $attachments = array())
{
$mailer = Billrun_Factory::mailer()->setSubject($subject)->setBodyText($body);
//add attachments
foreach ($attachments as $attachment) {
$mailer->addAttachment($attachment);
}
//set recipents
foreach ($recipients as $recipient) {
$mailer->addTo($recipient);
}
//sen email
return $mailer->send();
}