Example: Email

Example of mail API. (drupal 6)

This example module provides two different examples of the Drupal email API.

  • defines a simple contact form and shows how to use drupal_mail() to send an e-mail (defined in hook_mail()) when the form is submitted.
  • shows how modules can alter emails defined by other Drupal modules or Core using hook_mail_alter by attaching a custom signature before they are sent.

This example is part of the Examples for Developers Project which you can download and experiment with here: http://drupal.org/project/examples

Functions & methods

NameDescription
email_example_formThe contact form.
email_example_form_submitForm submission logic for the contact form.
email_example_form_validateForm validation logic for the contact form.
email_example_mailImplementation of hook_mail().
email_example_mail_alterImplementation of hook_mail_alter().
email_example_mail_sendSend an e-mail.
email_example_menuImplementation of hook_menu().

examples/email_example/email_example.module, line 16