The Dummy Extension provides several ‘placeholder’ type handlers to either mock operations or provide local-only usage during development. A perfect example is the DummyMailHandler that can be use during development or staging to prevent real email messages from being sent externally.


  • No external dependencies


  • See each handler’s documentation regarding what configurations they support.


from cement.core.foundation import CementApp

class MyApp(CementApp):
    class Meta:
        label = 'myapp'
        extensions = ['dummy']
        output_handler = 'dummy'
        mail_handler = 'dummy'

with MyApp() as app:
class cement.ext.ext_dummy.DummyMailHandler(*args, **kw)

Bases: cement.core.mail.CementMailHandler

This class implements the cement.core.mail.IMail interface, but is intended for use in development as no email is actually sent.


class MyApp(CementApp):
    class Meta:
        label = 'myapp'
        mail_handler = 'dummy'

with MyApp() as app:

    app.mail.send('This is my fake message',
        subject='This is my subject',
        to=['john@example.com', 'rita@example.com'],

The above will print the following to console:


To: john@example.com, rita@example.com
From: me@example.com
Subject: This is my subject


This is my fake message



This handler supports the following configuration settings:

  • to - Default to addresses (list, or comma separated depending on the ConfigHandler in use)
  • from_addr - Default from_addr address
  • cc - Default cc addresses (list, or comma separated depending on the ConfigHandler in use)
  • bcc - Default bcc addresses (list, or comma separated depending on the ConfigHandler in use)
  • subject - Default subject
  • subject_prefix - Additional string to prepend to the subject

You can add these to any application configuration file under a [mail.dummy] section, for example:



# set the mail handler to use
mail_handler = dummy


# default to addresses (comma separated list)
to = me@example.com

# default from address
from = someone_else@example.com

# default cc addresses (comma separated list)
cc = jane@example.com, rita@example.com

# default bcc addresses (comma separated list)
bcc = blackhole@example.com, someone_else@example.com

# default subject
subject = This is The Default Subject

# additional prefix to prepend to the subject
subject_prefix = MY PREFIX >
class Meta

Handler meta-data.

label = 'dummy'

Unique identifier for this handler

send(body, **kw)

Mimic sending an email message, but really just print what would be sent to console. Keyword arguments override configuration defaults (cc, bcc, etc).

  • body (multiline string) – The message body to send
  • to (list) – List of recipients (generally email addresses)
  • from_addr (str) – Address (generally email) of the sender
  • cc (list) – List of CC Recipients
  • bcc (list) – List of BCC Recipients
  • subject (str) – Message subject line

Boolean (True if message is sent successfully, False otherwise)


# Using all configuration defaults
app.mail.send('This is my message body')

# Overriding configuration defaults
app.mail.send('My message body'
    cc=['jane@example.com', 'rita@example.com'],
    subject='This is my subject',
class cement.ext.ext_dummy.DummyOutputHandler(*args, **kw)

Bases: cement.core.output.CementOutputHandler

This class is an internal implementation of the cement.core.output.IOutput interface. It does not take any parameters on initialization, and does not actually output anything.

class Meta

Handler meta-data


alias of cement.core.output.IOutput

label = 'dummy'

The string identifier of this handler.

overridable = False

Whether or not to include dummy as an available to choice to override the output_handler via command line options.

render(data_dict, template=None, **kw)

This implementation does not actually render anything to output, but rather logs it to the debug facility.

  • data_dict – The data dictionary to render.
  • template – The template parameter is not used by this implementation at all.