Zend\Mail\Transport\FileOptions

Overview

This document details the various options available to the Zend\Mail\Transport\File mail transport.

Quick Start

File Transport Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
use Zend\Mail\Transport\File as FileTransport;
use Zend\Mail\Transport\FileOptions;

// Setup File transport
$transport = new FileTransport();
$options   = new FileOptions(array(
    'path'              => 'data/mail/',
    'callback'  => function (FileTransport $transport) {
        return 'Message_' . microtime(true) . '_' . mt_rand() . '.txt';
    },
));
$transport->setOptions($options);

Configuration Options

Configuration Options

path
The path under which mail files will be written.
callback

A PHP callable to be invoked in order to generate a unique name for a message file. By default, the following is used:

1
2
3
function (Zend\Mail\FileTransport $transport) {
    return 'ZendMail_' . time() . '_' . mt_rand() . '.tmp';
}

Available Methods

Zend\Mail\Transport\FileOptions extends Zend\Stdlib\Options, and inherits all functionality from that class; this includes ArrayAccess and property overloading. Additionally, the following explicit setters and getters are provided.

__construct

setPath(string $path)

Set the path under which mail files will be written.

Implements fluent interface.

getPath

getPath()

Get the path under which mail files will be written.

Returns string

setCallback

setCallback(Callable $callback)

Set the callback used to generate unique filenames for messages.

Implements fluent interface.

getCallback

getCallback()

Get the callback used to generate unique filenames for messages.

Returns PHP callable argument.

__construct

__construct(null|array|Traversable $config)

Initialize the object. Allows passing a PHP array or Traversable object with which to populate the instance.

Examples

Please see the Quick Start for examples.

Table Of Contents

Previous topic

Zend\Mail\Transport\SmtpOptions

Next topic

Introduction to Zend\Math

This Page

Note: You need to stay logged into your GitHub account to contribute to the documentation.

Edit this document

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.

  1. Login with your GitHub account.
  2. Go to Zend\Mail\Transport\FileOptions on GitHub.
  3. Edit file contents using GitHub's text editor in your web browser
  4. Fill in the Commit message text box at the end of the page telling why you did the changes. Press Propose file change button next to it when done.
  5. On Send a pull request page you don't need to fill in text anymore. Just press Send pull request button.
  6. Your changes are now queued for review under project's Pull requests tab on GitHub.