Sends Messages over SMTP.

package Swift
subpackage Transport
author Chris Corbyn

 Methods

Creates a new EsmtpTransport using the given I/O buffer.

__construct(\Swift_Transport_IoBuffer $buf, \Swift_Events_EventDispatcher $dispatcher) 

Destructor.

__destruct() 

Run a command against the buffer, expecting the given response codes.

executeCommand(string $command, int[] $codes, string[] $failures) : string

If no response codes are given, the response will not be validated. If codes are given, an exception will be thrown on an invalid response.

Parameters

$command

string

$codes

int[]

$failures

string[]

&$failures

Returns

string

Get the IoBuffer where read/writes are occurring.

getBuffer() : \Swift_Transport_IoBuffer

Get the name of the domain Swift will identify as.

getLocalDomain() : string

Returns

string

Returns the ip used to connect to the destination

getSourceIp() : string

Returns

string

Test if an SMTP connection has been established.

isStarted() : boolean

Returns

boolean

Register a plugin.

registerPlugin(\Swift_Events_EventListener $plugin) 

Parameters

Reset the current mail transaction.

reset() 

Send the given Message.

send(\Swift_Mime_Message $message, string[] $failedRecipients) : int

Recipient/sender data will be retrieved from the Message API. The return value is the number of recipients who were accepted for delivery.

Parameters

$failedRecipients

string[]

&$failedRecipients to collect failures by-reference

Returns

int

Set the name of the local domain which Swift will identify itself as.

setLocalDomain(string $domain) : \Swift_Transport_AbstractSmtpTransport

This should be a fully-qualified domain name and should be truly the domain you're using. If your server doesn't have a domain name, use the IP in square brackets (i.e. [127.0.0.1]).

Parameters

$domain

string

Returns

Sets the sourceIp

setSourceIp(string $source) 

Parameters

$source

string

Start the SMTP connection.

start() 

Stop the SMTP connection.

stop() 

Throws an Exception if a response code is incorrect

_assertResponseCode($response, $wanted) 

Parameters

$response

$wanted

Send the DATA command

_doDataCommand() 

Send the HELO welcome

_doHeloCommand() 

Send the MAIL FROM command

_doMailFromCommand($address) 

Parameters

$address

Send the RCPT TO command

_doRcptToCommand($address) 

Parameters

$address

Return an array of params for the Buffer

_getBufferParams() 

Get an entire multi-line response using its sequence number

_getFullResponse($seq) 

Parameters

$seq

Determine the best-use reverse path for this message

_getReversePath(\Swift_Mime_Message $message) 

Parameters

$message

Read the opening SMTP greeting

_readGreeting() 

Stream the contents of the message over the buffer

_streamMessage(\Swift_Mime_Message $message) 

Parameters

$message

Throw a TransportException, first sending it to any listeners

_throwException(\Swift_TransportException $e) 

Parameters

$e

Send an email to the given recipients from the given reverse path

_doMailTransaction($message, $reversePath, array $recipients, array $failedRecipients) 

Parameters

$message

$reversePath

$recipients

$failedRecipients

Determine is the $hostname is a fully-qualified name

_isFqdn($hostname) 

Parameters

$hostname

Try to determine the hostname of the server this is run on

_lookupHostname() 

Send a message to all Bcc: recipients

_sendBcc(\Swift_Mime_Message $message, $reversePath, array $bcc, array $failedRecipients) 

Parameters

$message

$reversePath

$bcc

$failedRecipients

Send a message to the given Cc: recipients

_sendCc(\Swift_Mime_Message $message, $reversePath, array $cc, array $failedRecipients) 

Parameters

$message

$reversePath

$cc

$failedRecipients

Send a message to the given To: recipients

_sendTo(\Swift_Mime_Message $message, $reversePath, array $to, array $failedRecipients) 

Parameters

$message

$reversePath

$to

$failedRecipients

 Properties

 

$_buffer 
 

$_domain 
 

$_eventDispatcher 
 

$_sourceIp 
 

$_started