This repository has been archived by the owner on Jun 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Core_Mailer
AlexFloppy edited this page Jan 27, 2015
·
3 revisions
Данный компонент позволяет организовать хранилище шаблонов писем в вашей системе, с возможностью изменения шаблонов с панели администратора.
Пример настройки хранилища шаблонов писем на основе БД
resources:
frontController:
mailer:
storage:
type: DbTable
options:
table: Model_Mail_Table
resources:
frontController:
mailer:
transport:
type: ZendMail
options:
fromEmail: zfc@nixsolutions.com
fromName: ZFCore Webmaster
charset: UTF-8
transport:
class: Zend_Mail_Transport_Smtp
host: stubmail.nixsolutions.com
port: 2500
resources:
frontController:
mailer:
transport:
type: ZendMail
options:
fromEmail: zfc@nixsolutions.com
fromName: ZFCore Webmaster
charset: UTF-8
transport:
class: Zend_Mail_Transport_Sendmail
params:
- -fzfc@nixsolutions.com
resources:
frontController:
mailer:
transport:
type: ZendMail
options:
fromEmail: zfc@nixsolutions.com
fromName: ZFCore Webmaster
charset: UTF-8
transport:
class: Zend_Mail_Transport_File
path: APPLICATION_PATH/../data/mail
Приведу пример использования с комментариями:
<?php
// получаем шаблон из хранилища по уникальному идентификатору
$template = Core_Mailer::getTemplate('registration');
// настраиваем адресат
$template->toEmail = $email;
$template->toName = $login;
// назначаем переменные - будут проведены замены для %host% и %hash% во всех полях
$template->assign('hash', $hashCode);
$template->assign('host', $_SERVER['HTTP_HOST']);
// отправляем сообщение
Core_Mailer::send($template);
?>