webCOMAND

mail::option()

Add or update an email option.  To set multiple options with a single method call, see mail::options().

Prototype

void option(string $key, string $value = NULL, boolean $ignore_invalid = FALSE)

Parameters

  • key - Option name, which may be one of the following.
    • adapter - mail_adapter to use (actual adapter object, will take precedence over adapter_class).
    • adapter_class - mail_adapter to use (adapter class name, will be ignored if adapter specified).
    • bcc - String or array of strings containing email address(es).  The main email will also be sent to each specified email address with information about where the original email was sent.  Note, this is different than specifying a "bcc" email header when sending an email because these email addresses are not added to the bcc header or automatically sent as part of the standard email process.  Instead, the API will actually send additional versions of the original email to these addresses, for the record.
    • bcc_adapter_class - mail adapter to use for BCC email sending.
    • library_path - File system path where the library code can be found.
    • mail_log - File system path where to log events related to the specific mail operations.
    • level - Event level of logs to include in mail_log (ie. 4=ERROR, 5=WARNING).
    • smtp_host - use an explicit host (default library host, typically localhost used otherwise).
    • smtp_port - use an explicit port number (default library port, typically port 25 used otherwise).
    • smtp_auth - TRUE to use authentication, otherwise FALSE.
    • smtp_username - Username to use if smtp_auth is TRUE.
    • smtp_password - Password to use if smtp_auth is TRUE.
    • smtp_security - 'tls', 'ssl', 'smtp'
    • smtp_ssl_verify_peer - TRUE (default) to verify valid SSL certificate, FALSE to skip.
    • smtp_ssl_verify_peer_name - TRUE (default) to verify valid SSL certificate for hostname, FALSE to skip.
    • smtp_ssl_allow_self_signed - TRUE to allow self-signed certificates, FALSE (default) to not allow them.
    • smtp_debug - 0=None, >0=debug level specific to adapter (see adapater config).
  • value - Optional value to associate with the key, as specified above.
  • ignore_invalid - FALSE (default) to throw an exception if the key is not recognized.  TRUE to to silently skip setting the option if the key is not valid.

Example

$mail = new \io_comand_email\mail(
    'webmaster@webcomand.com',
    'Testing',
    "<p>This is a test.<br/>\nTesting 1, 2, 3.</p>"
);
$mail->option('bcc', 'archive@example.com');
$mail->option('smtp_ssl_verify_peer', FALSE);
$mail->send();

Related