Mailing lists

The mail module sends newsletters — a digest of news, or issues written in the admin — and keeps the templates of the site's letters.
Newsletters
- «Рассылки» (Newsletters,
/admin/mail-subscriptions/): a name and description in each language; «Источник данных» (Data source) — «Новости» (News) or «CRM-рассылка» (CRM newsletter); «Периодичность» (Frequency) — hourly, daily, weekly or monthly; «Подписывать новых подписчиков автоматически» (Subscribe new subscribers automatically); «Не показывать в списке подписок» (Hide from the subscription list); the tabs «Подписанные пользователи» (Subscribed users) and «Подписанные e-mail» (Subscribed e-mails). - «Сообщения рассылки» (Newsletter messages,
/admin/mail-crm/) — the issues of CRM newsletters, with «Дата выпуска» (Issue date) and «Включать в рассылку» (Include in the mailing). - «Подписчики рассылок» (Newsletter subscribers,
/admin/mail-subscribers/) — subscribers by e-mail. - On
/subscribe/«Подписка на рассылку» (Newsletter subscription) a visitor gives an e-mail and gets every active newsletter that subscribes new subscribers. Signed-in users choose their newsletters on/subscriptions/«Мои подписки» (My subscriptions).
Sending
A console command sends the newsletters; run it from the project's folder:
php cli/mail_sender.php run
The release does not schedule it: run it from cron, hourly for example. Each run sends the newsletters whose period has passed, with the news or issues since the last sending — at most 100 — one letter to each subscriber, in the default language. Letters go through PHP's mail(). With site.debug on, newsletters are not sent but appended to htdocs/uploads/tmp/mailout.txt, a file the web server serves — see Known risks.
Mail templates
«Шаблоны писем» (Mail templates, /admin/mail-templates/) keeps the letters of registration, password restore, the feedback form and newsletters: in each language the subject, the text and the HTML, with the macros such as [user_name] listed in «Подсказки (доступные макросы)» (Hints — available macros). In the HTML the values are escaped. A template can't be deleted, only switched off.
For developers
- A new kind of newsletter: a value of
mail_subscriptions.subscription_type, a class implementingEnergine\mail\gears\IMailSourceand its entry inmail.subscriptionsof the configuration. - A letter from code:
Energine\mail\gears\MailTemplatefills a template,Energine\mail\gears\Mailsends it.