Documentation

Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTransport
in package

SendmailTransport for sending mail through a Sendmail/Postfix (etc..) binary.

Supported modes are -bs and -t, with any additional flags desired. It is advised to use -bs mode since error reporting with -t mode is not possible.

Tags
author

Chris Corbyn

Table of Contents

$addressEncoder  : mixed
$buffer  : mixed
Input-Output buffer for sending/receiving SMTP commands and responses
$domain  : mixed
The domain name to use in HELO command
$eventDispatcher  : mixed
The event dispatching layer
$pipeline  : mixed
The pipelined commands waiting for response
$pipelining  : mixed
Whether the PIPELINING SMTP extension is enabled (RFC 2920)
$sourceIp  : mixed
Source Ip
$started  : mixed
Connection status
$params  : array<string|int, mixed>
Connection buffer parameters.
__construct()  : mixed
Create a new SendmailTransport with $buf for I/O.
__destruct()  : mixed
Destructor.
executeCommand()  : string|null
Run a command against the buffer, expecting the given response codes.
getAddressEncoder()  : mixed
getBuffer()  : Swift_Transport_IoBuffer
Get the IoBuffer where read/writes are occurring.
getCommand()  : string
Get the sendmail command which will be invoked.
getLocalDomain()  : string
Get the name of the domain Swift will identify as.
getSourceIp()  : string
Returns the IP used to connect to the destination.
isStarted()  : bool
Test if an SMTP connection has been established.
ping()  : bool
Check if this Transport mechanism is alive.
registerPlugin()  : mixed
Register a plugin.
reset()  : mixed
Reset the current mail transaction.
send()  : int
Send the given Message.
setAddressEncoder()  : mixed
setCommand()  : $this
Set the command to invoke.
setLocalDomain()  : $this
Set the name of the local domain which Swift will identify itself as.
setSourceIp()  : mixed
Sets the source IP.
start()  : mixed
Start the standalone SMTP session if running in -bs mode.
stop()  : mixed
Stop the SMTP connection.
assertResponseCode()  : mixed
Throws an Exception if a response code is incorrect
doDataCommand()  : mixed
Send the DATA command
doHeloCommand()  : mixed
Send the HELO welcome
doMailFromCommand()  : mixed
Send the MAIL FROM command
doRcptToCommand()  : mixed
Send the RCPT TO command
getBufferParams()  : mixed
Get the params to initialize the buffer
getFullResponse()  : mixed
Get an entire multi-line response using its sequence number
getReversePath()  : mixed
Determine the best-use reverse path for this message
readGreeting()  : mixed
Read the opening SMTP greeting
streamMessage()  : mixed
Stream the contents of the message over the buffer
throwException()  : mixed
Throw a TransportException, first sending it to any listeners
doMailTransaction()  : mixed
Send an email to the given recipients from the given reverse path
sendBcc()  : mixed
Send a message to all Bcc: recipients
sendTo()  : mixed
Send a message to the given To: recipients

Properties

$buffer

Input-Output buffer for sending/receiving SMTP commands and responses

protected mixed $buffer

$pipelining

Whether the PIPELINING SMTP extension is enabled (RFC 2920)

protected mixed $pipelining = ull

$params

Connection buffer parameters.

private array<string|int, mixed> $params = ['timeout' => 30, 'blocking' => 1, 'command' => '/usr/sbin/sendmail -bs', 'type' => Swift_Transport_IoBuffer::TYPE_PROCESS]

Methods

executeCommand()

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

public executeCommand(string $command[, array<string|int, int> $codes = [] ][, array<string|int, string> &$failures = null ][, bool $pipeline = false ][, string $address = null ]) : string|null

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. If the command is RCPT TO, and the pipeline is non-empty, no exception will be thrown; instead the failing address is added to $failures.

Parameters
$command : string
$codes : array<string|int, int> = []
$failures : array<string|int, string> = null

An array of failures by-reference

$pipeline : bool = false

Do not wait for response

$address : string = null

The address, if command is RCPT TO.

Return values
string|null

The server response, or null if pipelining is enabled

getCommand()

Get the sendmail command which will be invoked.

public getCommand() : string
Return values
string

getLocalDomain()

Get the name of the domain Swift will identify as.

public getLocalDomain() : string

If an IP address was specified, this will be returned wrapped in square brackets as described in RFC 5321, section 4.1.3.

Return values
string

getSourceIp()

Returns the IP used to connect to the destination.

public getSourceIp() : string
Return values
string

isStarted()

Test if an SMTP connection has been established.

public isStarted() : bool
Return values
bool

ping()

Check if this Transport mechanism is alive.

public ping() : bool
Return values
bool

TRUE if the transport is alive

send()

Send the given Message.

public send(Swift_Mime_SimpleMessage $message[, array<string|int, string> &$failedRecipients = null ]) : int

Recipient/sender data will be retrieved from the Message API.

The return value is the number of recipients who were accepted for delivery. NOTE: If using 'sendmail -t' you will not be aware of any failures until they bounce (i.e. send() will always return 100% success).

Parameters
$message : Swift_Mime_SimpleMessage
$failedRecipients : array<string|int, string> = null

An array of failures by-reference

Return values
int

setCommand()

Set the command to invoke.

public setCommand(string $command) : $this

If using -t mode you are strongly advised to include -oi or -i in the flags. For example: /usr/sbin/sendmail -oi -t Swift will append a -f flag if one is not present.

The recommended mode is "-bs" since it is interactive and failure notifications are hence possible.

Parameters
$command : string
Return values
$this

setLocalDomain()

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

public setLocalDomain(string $domain) : $this

This should be a fully-qualified domain name and should be truly the domain you're using.

If your server does not have a domain name, use the IP address. This will automatically be wrapped in square brackets as described in RFC 5321, section 4.1.3.

Parameters
$domain : string
Return values
$this

setSourceIp()

Sets the source IP.

public setSourceIp(string $source) : mixed
Parameters
$source : string
Return values
mixed

start()

Start the standalone SMTP session if running in -bs mode.

public start() : mixed
Return values
mixed

assertResponseCode()

Throws an Exception if a response code is incorrect

protected assertResponseCode(mixed $response, mixed $wanted) : mixed
Parameters
$response : mixed
$wanted : mixed
Return values
mixed

doDataCommand()

Send the DATA command

protected doDataCommand(mixed &$failedRecipients) : mixed
Parameters
$failedRecipients : mixed
Return values
mixed

doHeloCommand()

Send the HELO welcome

protected doHeloCommand() : mixed
Return values
mixed

doMailFromCommand()

Send the MAIL FROM command

protected doMailFromCommand(mixed $address) : mixed
Parameters
$address : mixed
Return values
mixed

doRcptToCommand()

Send the RCPT TO command

protected doRcptToCommand(mixed $address) : mixed
Parameters
$address : mixed
Return values
mixed

getBufferParams()

Get the params to initialize the buffer

protected getBufferParams() : mixed
Return values
mixed

getFullResponse()

Get an entire multi-line response using its sequence number

protected getFullResponse(mixed $seq) : mixed
Parameters
$seq : mixed
Return values
mixed

readGreeting()

Read the opening SMTP greeting

protected readGreeting() : mixed
Return values
mixed

doMailTransaction()

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

private doMailTransaction(mixed $message, mixed $reversePath, array<string|int, mixed> $recipients, array<string|int, mixed> &$failedRecipients) : mixed
Parameters
$message : mixed
$reversePath : mixed
$recipients : array<string|int, mixed>
$failedRecipients : array<string|int, mixed>
Return values
mixed

sendBcc()

Send a message to all Bcc: recipients

private sendBcc(Swift_Mime_SimpleMessage $message, mixed $reversePath, array<string|int, mixed> $bcc, array<string|int, mixed> &$failedRecipients) : mixed
Parameters
$message : Swift_Mime_SimpleMessage
$reversePath : mixed
$bcc : array<string|int, mixed>
$failedRecipients : array<string|int, mixed>
Return values
mixed

sendTo()

Send a message to the given To: recipients

private sendTo(Swift_Mime_SimpleMessage $message, mixed $reversePath, array<string|int, mixed> $to, array<string|int, mixed> &$failedRecipients) : mixed
Parameters
$message : Swift_Mime_SimpleMessage
$reversePath : mixed
$to : array<string|int, mixed>
$failedRecipients : array<string|int, mixed>
Return values
mixed

Search results