Go to page content

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

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.

Comments

  • avatar

    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?

  • avatar

    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?

  • avatar

    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.

  • avatar

    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 ?

  • avatar

    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.

  • avatar

    Holger Winkelmann

    Posted 1 year, 3 months ago.

    Can I use another template for the text only part of multipart HTML email?

  • avatar

    Marc Worrell

    Posted 1 year, 2 months ago.

    Yes, you can supply separate templates for the html and the text parts.