Go to page content

mod_emailer

[up to 0.6] 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

ModuleKeyValue
mod_emaileremail_fromSet this to the from-address you want to e-mail to appear from, e.g. something like noreply@yoursite.com.
mod_emaileremail_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:

ModuleKeyValue
mod_emailersmtp_hostThe hostname on which the SMTP server is running. Defaults to localhost.
mod_emailersmtp_portPortnumber for the SMTP server. Defaults to 25.
mod_emailersmtp_sslBoolean flag. Put "true" to use SSL for the SMTP connection. Defaults to false.
mod_emailersmtp_ehloThe hostname for the EHLO command that is sent on initialization of the SMTP session.
mod_emailersmtp_usernameSMTP username. Default empty.
mod_emailersmtp_passwordSMTP 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.

ModuleKeyValue
mod_emailersendmail/path/so/sendmail

 

mod_emailer quickstart

Once you enabled and configured mod_emailer, you can try out these commands to send e-mails:

C

CommandExplanation
z_email:send_admin/3Sends 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/4Sends a text message with a subject to a specified recipient.
z_email:send_render/4Renders 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.