SMTP connection object

Loads an instance of Zend\Mail\Protocol\Smtp and forwards smtp transactions

package Default

 Methods

Constructor.

__construct(\Zend\Mail\Transport\SmtpOptions $options = null

Parameters

$options

\Zend\Mail\Transport\SmtpOptions

Optional

Class destructor to ensure all open connections are closed

__destruct() 

Disconnect the connection protocol instance

disconnect() : void

Get the automatic disconnection value

getAutoDisconnect() : boolean

Returns

boolean

Gets the connection protocol instance

getConnection() : \Zend\Mail\Protocol\Smtp

Returns

\Zend\Mail\Protocol\Smtp

Get envelope

getEnvelope() : \Zend\Mail\Transport\Envelope | null

Returns

\Zend\Mail\Transport\Envelopenull

Get options

getOptions() : \Zend\Mail\Transport\SmtpOptions

Returns

\Zend\Mail\Transport\SmtpOptions

Get plugin manager for loading SMTP protocol connection

getPluginManager() : \Zend\Mail\Protocol\SmtpPluginManager

Returns

\Zend\Mail\Protocol\SmtpPluginManager

Return an SMTP connection

plugin(string $name, array|null $options = null) : \Zend\Mail\Protocol\Smtp

Parameters

$name

string

$options

arraynull

Returns

\Zend\Mail\Protocol\Smtp

Send an email via the SMTP connection protocol

send(\Zend\Mail\Message $message) 

The connection via the protocol adapter is made just-in-time to allow a developer to add a custom adapter if required before mail is sent.

inherited_from \Zend\Mail\Transport\TransportInterface::send()

Parameters

$message

\Zend\Mail\Message

Exceptions

\Zend\Mail\Transport\Exception\RuntimeException

Set the automatic disconnection when destruct

setAutoDisconnect(boolean $flag) : \Zend\Mail\Transport\Smtp

Parameters

$flag

boolean

Returns

\Zend\Mail\Transport\Smtp

Sets the connection protocol instance

setConnection(\Zend\Mail\Protocol\AbstractProtocol $connection) 

Parameters

$connection

\Zend\Mail\Protocol\AbstractProtocol

Set options

setEnvelope(\Zend\Mail\Transport\Envelope $envelope) 

Parameters

$envelope

\Zend\Mail\Transport\Envelope

Set options

setOptions(\Zend\Mail\Transport\SmtpOptions $options) : \Zend\Mail\Transport\Smtp

Parameters

$options

\Zend\Mail\Transport\SmtpOptions

Returns

\Zend\Mail\Transport\Smtp

Set plugin manager for obtaining SMTP protocol connection

setPluginManager(\Zend\Mail\Protocol\SmtpPluginManager $plugins) : \Zend\Mail\Transport\Smtp

Parameters

$plugins

\Zend\Mail\Protocol\SmtpPluginManager

Exceptions

\Zend\Mail\Transport\Exception\InvalidArgumentException

Returns

\Zend\Mail\Transport\Smtp

Connect the connection, and pass it helo

connect() : \Zend\Mail\Protocol\Smtp

Returns

\Zend\Mail\Protocol\Smtp

Lazy load the connection

lazyLoadConnection() : \Zend\Mail\Protocol\Smtp

Returns

\Zend\Mail\Protocol\Smtp

Prepare body string from message

prepareBody(\Zend\Mail\Message $message) : string

Parameters

$message

\Zend\Mail\Message

Returns

string

Retrieve email address for envelope FROM

prepareFromAddress(\Zend\Mail\Message $message) : string

Parameters

$message

\Zend\Mail\Message

Exceptions

\Zend\Mail\Transport\Exception\RuntimeException

Returns

string

Prepare header string from message

prepareHeaders(\Zend\Mail\Message $message) : string

Parameters

$message

\Zend\Mail\Message

Returns

string

Prepare array of email address recipients

prepareRecipients(\Zend\Mail\Message $message) : array

Parameters

$message

\Zend\Mail\Message

Returns

array

 Properties

 

$autoDisconnect

$autoDisconnect : boolean

Default

true
 

$connection

$connection : \Zend\Mail\Protocol\Smtp

Default

 

$envelope

$envelope : \Zend\Mail\Transport\Envelope | null

Default

 

$options

$options : \Zend\Mail\Transport\SmtpOptions

Default

 

$plugins

$plugins : \Zend\Mail\Protocol\SmtpPluginManager

Default