|
|
This document details the various options available to the
Zend\Mail\Transport\Smtp mail transport.
Example #1 Basic SMTP Transport Usage
use Zend\Mail\Transport\Smtp as SmtpTransport,
Zend\Mail\Transport\SmtpOptions;
// Setup SMTP transport
$transport = new SmtpTransport();
$options = new SmtpOptions(array(
'name' => 'localhost.localdomain',
'host' => '127.0.0.1',
'port' => 25,
));
$transport->setOptions($options);
Example #2 SMTP Transport Usage with PLAIN AUTH
use Zend\Mail\Transport\Smtp as SmtpTransport,
Zend\Mail\Transport\SmtpOptions;
// Setup SMTP transport using LOGIN authentication
$transport = new SmtpTransport();
$options = new SmtpOptions(array(
'name' => 'localhost.localdomain',
'host' => '127.0.0.1',
'connection_class' => 'plain',
'connection_config' => array(
'username' => 'user',
'password' => 'pass',
),
));
$transport->setOptions($options);
Example #3 SMTP Transport Usage with LOGIN AUTH
use Zend\Mail\Transport\Smtp as SmtpTransport,
Zend\Mail\Transport\SmtpOptions;
// Setup SMTP transport using LOGIN authentication
$transport = new SmtpTransport();
$options = new SmtpOptions(array(
'name' => 'localhost.localdomain',
'host' => '127.0.0.1',
'connection_class' => 'login',
'connection_config' => array(
'username' => 'user',
'password' => 'pass',
),
));
$transport->setOptions($options);
Example #4 SMTP Transport Usage with CRAM-MD5 AUTH
use Zend\Mail\Transport\Smtp as SmtpTransport,
Zend\Mail\Transport\SmtpOptions;
// Setup SMTP transport using LOGIN authentication
$transport = new SmtpTransport();
$options = new SmtpOptions(array(
'name' => 'localhost.localdomain',
'host' => '127.0.0.1',
'connection_class' => 'crammd5',
'connection_config' => array(
'username' => 'user',
'password' => 'pass',
),
));
$transport->setOptions($options);
Name of the SMTP host; defaults to "localhost".
Remote hostname or IP address; defaults to "127.0.0.1".
Port on which the remote host is listening; defaults to "25".
Fully-qualified classname or short name resolvable via
Zend\Mail\Protocol\SmtpLoader. Typically, this will
be one of "smtp", "plain", "login", or "crammd5", and defaults to "smtp".
Typically, the connection class should extend the
Zend\Mail\Protocol\AbstractProtocol class, and
specifically the SMTP variant.
Optional associative array of parameters to pass to the connection class in order to configure it. By default this is empty. For connection classes other than the default, you will typically need to define the "username" and "password" options.
Returns the string name of the local client hostname.
Set the string name of the local client hostname.
Implements a fluent interface.
Returns a string indicating the connection class name to use.
Set the connection class to use.
Implements a fluent interface.
Get configuration for the connection class.
Returns array.
Set configuration for the connection class. Typically, if using anything other than the default connection class, this will be an associative array with the keys "username" and "password".
Implements a fluent interface.
Returns a string indicating the IP address or host name of the SMTP server via which to send messages.
Set the SMTP host name or IP address.
Implements a fluent interface.
Retrieve the integer port on which the SMTP host is listening.
Set the port on which the SMTP host is listening.
Implements a fluent interface.
Instantiate the class, and optionally configure it with values provided.
Please see the Quick Start for examples.
|
|
Copyright © 2005-2011 Zend Technologies Inc (compiled by mikaelkael with ZFDocumentor - GIT c517eb0).

