Using the email module, you only have the option of outputting the email address as a link, the email address as plain text, or a link to a web form. What I want is to just print the word "email" as mailto link.

For example: In display suite using the link field formatter, you can opt to use the label as the link so the website displays the word "website" which is a hyperlink to the actual url. Is their anyway to do this with email?

  • I am not sure where exactly you are adding mail link.However you do not need any module for your requirement simply adding html code as <a href="mailto:[email protected]">email</a> will work
    – arpitr
    Commented Sep 30, 2013 at 19:52
  • Sorry if it wasn't clear. I have a field for adding an email address to a content type. I am using the email module to make the field into a link automatically. It needs to be simple enough for the users to just add the email address to the individual pieces of content and not think about what the code looks like.
    – Colin
    Commented Sep 30, 2013 at 19:55

1 Answer 1


It looks like you want to have one more custom field formatter. In order to create a custom field formatter all we need is implementation of 2 hooks

so code will be like this

 * Implements hook_field_formatter_info().
function mymodule_field_formatter_info() {
  // Add a setting to a formatter type.
  $formats = array(
    'email_custom' => array(
      'label' => t('Email Custom'),
      'description' => t('Display the email address as custom format.'),
      'field types' => array('email'),
    return $formats;

 * Implements hook_field_formatter_view().
function mymodule_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {
    case 'email_custom':
      foreach ($items as $delta => $item) {
        $output = l("email", 'mailto:' . $item['email']);
        $element[$delta] = array('#markup' => $output);
  return $element;

after adding this codes to your custom module clear the caches and you will see one more field formatter as Email Custom(you can change the labels in above code). Now your configurations in manage display for this field will be .

  1. Hide your field label
  2. Select Email Custom as field format

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.