You are here

function webform_email_html_capable in Webform 7.3

Same name and namespace in other branches
  1. 6.3 webform.module \webform_email_html_capable()

Check if any available HTML mail handlers are available for Webform to use.

3 calls to webform_email_html_capable()
webform_admin_settings in includes/webform.admin.inc
Menu callback for admin/config/content/webform.
webform_email_edit_form in includes/webform.emails.inc
Form for configuring an e-mail setting and template.
webform_submission_send_mail in includes/webform.submissions.inc
Send related e-mails related to a submission.

File

./webform.module, line 3877
This module provides a simple way to create forms and questionnaires.

Code

function webform_email_html_capable() {

  // TODO: Right now we only support MIME Mail and HTML Mail. Support others
  // if available through a hook?
  $supported_html_modules = array(
    'mimemail' => 'MimeMailSystem',
    'htmlmail' => 'HTMLMailSystem',
  );
  foreach ($supported_html_modules as $mail_module => $mail_system_name) {
    if (module_exists($mail_module)) {
      $mail_systems = variable_get('mail_system', array(
        'default-system' => 'DefaultMailSystem',
      ));
      if (isset($mail_systems['webform'])) {
        $enable = strpos($mail_systems['webform'], $mail_system_name) !== FALSE ? $mail_systems['webform'] : FALSE;
      }
      else {
        $enable = $mail_system_name;
      }
    }
  }
  if (!empty($enable)) {

    // We assume that if a solution exists even if it's not specified we should
    // use it. Webform will specify if e-mails sent with the system are plain-
    // text or not when sending each e-mail.
    $GLOBALS['conf']['mail_system']['webform'] = $enable;
    return TRUE;
  }
  return FALSE;
}