mod_emailer
Sends e-mail using SMTP or sendmail.
As of Zotonic 0.7, e-mail handling is part of Zotonic's core. Read the page about the new e-mail system here.The information below is ONLY for Zotonic 0.6 and below.
This module functions as a simple mailing system for sending text and HTML messages to one or more recipients.
Generic configuration
| Module | Key | Value |
| mod_emailer | email_from | Set this to the from-address you want to e-mail to appear from, e.g. something like noreply@yoursite.com. |
| mod_emailer | email_override | If set, all e-mail messages that get sent from zotonic through mod_emailer go to this address. Usefull if you are testing but don't want to confuse other people with your test e-mails. New in Zotonic 0.5. |
SMTP config
You'll need to fill these config keys:
| Module | Key | Value |
| mod_emailer | smtp_host | The hostname on which the SMTP server is running. Defaults to localhost. |
| mod_emailer | smtp_port | Portnumber for the SMTP server. Defaults to 25. |
| mod_emailer | smtp_ssl | Boolean flag. Put "true" to use SSL for the SMTP connection. Defaults to false. |
| mod_emailer | smtp_ehlo | The hostname for the EHLO command that is sent on initialization of the SMTP session. |
| mod_emailer | smtp_username | SMTP username. Default empty. |
| mod_emailer | smtp_password | SMTP password. Default empty. |
Sendmail config
You can also use the sendmail program to send mails. Sendmail will be called like this: sendmail -f from-address to-address.
| Module | Key | Value |
| mod_emailer | sendmail | /path/so/sendmail |
mod_emailer quickstart
Once you enabled and configured mod_emailer, you can try out these commands to send e-mails:
C
| Command | Explanation |
| z_email:send_admin/3 | Sends a quick e-mail to the site administrator. Handy to notice the site admin that something is wrong, a job has finished, etc... The e-mail that is used is the admin_email address that is specified in the site's config file. |
| z_email:send/4 | Sends a text message with a subject to a specified recipient. |
| z_email:send_render/4 | Renders a template and sends it as a HTML message to a specified recipient. |
This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.
Comments
Mathieu
Posted 1 year, 9 months ago.
"Once you enabled and configured mod_emailer, ..."
How? which file to edit? how does one enable a module?
Mathieu
Posted 1 year, 9 months ago.
Nevermind, I think I just have to create the right keys/values from the "config" page in the admin menu, right?
Marc Worrell
Posted 1 year, 9 months ago.
You can enable the mod_emailer module on the /admin/modules page.
The configuration can be done on the config page or in your site's configuration file.
Holger Winkelmann
Posted 1 year, 5 months ago.
are the values you configure on the config page written back in the site config file? Or is the site config file loaded at startup and sored somewhere else ?
Marc Worrell
Posted 1 year, 5 months ago.
The site config file is loaded and cached (in the depcache). The configuration on the confg page is stored in the config table and overrules the config from the site's config file.
Holger Winkelmann
Posted 1 year, 3 months ago.
Can I use another template for the text only part of multipart HTML email?
Marc Worrell
Posted 1 year, 2 months ago.
Yes, you can supply separate templates for the html and the text parts.