This example demonstrates how to use the mail API.

This module provides two different examples of the Backdrop email API:

  • Defines a simple contact form and shows how to use backdrop_mail() to send an e-mail (defined in hook_mail()) when the form is submitted.
  • Shows how modules can alter emails defined by other modules, using hook_mail_alter(), to attach a custom signature before they are sent.

Parent topics

File

modules/examples/email_example/email_example.module, line 7
Hook implementations for the Email Example module.

Functions

Namesort descending Location Description
email_example_form modules/examples/email_example/email_example.module The contact form.
email_example_form_submit modules/examples/email_example/email_example.module Form submission logic for the contact form.
email_example_form_validate modules/examples/email_example/email_example.module Form validation logic for the contact form.
email_example_mail modules/examples/email_example/email_example.module Implements hook_mail().
email_example_mail_alter modules/examples/email_example/email_example.module Implements hook_mail_alter().
email_example_mail_send modules/examples/email_example/email_example.module Sends an e-mail.
email_example_menu modules/examples/email_example/email_example.module Implements hook_menu().

Classes

Namesort descending Location Description
EmailExampleTestCase modules/examples/email_example/tests/email_example.test Functionality tests for email example module.