You are here

function _views_send_format_address in Views Send 8

Same name and namespace in other branches
  1. 6 views_send.module \_views_send_format_address()
  2. 7 views_send.module \_views_send_format_address()

Build a formatted e-mail address.

2 calls to _views_send_format_address()
views_send_confirm_form in ./views_send.module
Implements the form for the "confirm" step.
_views_send_prepare_mail in ./views_send.module
Prepare the mail message before sending or spooling.

File

./views_send.module, line 736
The Views Send module.

Code

function _views_send_format_address($mail, $name, $encode = TRUE) {

  // Do not format addres on Windows based PHP systems or when $name is empty.
  if (substr(PHP_OS, 0, 3) == 'WIN' || empty($name)) {
    return $mail;
  }
  else {
    $display_name = $encode ? Mail::formatDisplayName($name) : $name;
    return sprintf('"%s" <%s>', $display_name, $mail);
  }
}