Function __global->_form_to_email

Definitions

sources/mail_forms.php

  • Worker function for form_to_email.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$extra_boring_fields array No No [] N/A N/A Fields to skip in addition to the normal skipped ones
$subject ?string No No Null N/A N/A The subject of the e-mail (null: from POSTed/tagged subject parameter)
$subject_prefix string No No Blank (empty string) N/A N/A The prefix text to the e-mail subject (blank: none)
$subject_suffix string No No Blank (empty string) N/A N/A The suffix text to the e-mail subject (blank: none)
$body_prefix string No No Blank (empty string) N/A N/A The prefix text to the e-mail body (blank: none)
$body_suffix string No No Blank (empty string) N/A N/A The suffix text to the e-mail body (blank: none)
$fields ?array No No Null N/A N/A A map of field names to field titles to transmit. (null: all POSTed fields, except certain standardised ones)
$to_email ?EMAIL No No Null N/A N/A E-mail address to send to (null: look from POST environment [if allowed] / staff address)
$is_via_post boolean No No True N/A N/A Whether $fields refers to some POSTed fields, as opposed to a direct field->value map
$store_attachments_to ?URLPATH No No Null N/A N/A Relative path to store uploaded attachments (null: do not store, and only return filename in $attachments array)

Returns

  • A tuple: subject, message, to e-mail, to name, from e-mail, from name, attachments, body parts (if calling code wants partials instead of a single $message)
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Worker function for form_to_email.
 *
 * @param  array $extra_boring_fields Fields to skip in addition to the normal skipped ones
 * @param  ?string $subject The subject of the e-mail (null: from POSTed/tagged subject parameter)
 * @param  string $subject_prefix The prefix text to the e-mail subject (blank: none)
 * @param  string $subject_suffix The suffix text to the e-mail subject (blank: none)
 * @param  string $body_prefix The prefix text to the e-mail body (blank: none)
 * @param  string $body_suffix The suffix text to the e-mail body (blank: none)
 * @param  ?array $fields A map of field names to field titles to transmit. (null: all POSTed fields, except certain standardised ones)
 * @param  ?EMAIL $to_email E-mail address to send to (null: look from POST environment [if allowed] / staff address)
 * @param  boolean $is_via_post Whether $fields refers to some POSTed fields, as opposed to a direct field->value map
 * @param  ?URLPATH $store_attachments_to Relative path to store uploaded attachments (null: do not store, and only return filename in $attachments array)
 * @return array A tuple: subject, message, to e-mail, to name, from e-mail, from name, attachments, body parts (if calling code wants partials instead of a single $message)
 */

function _form_to_email(array $extra_boring_fields = [], ?string $subject = null, string $subject_prefix = '', string $subject_suffix = '', string $body_prefix = '', string $body_suffix = '', ?array $fields = null, ?string $to_email = null, bool $is_via_post = true, ?string $store_attachments_to = null) : array