\apex\app\teststest_emailer

Handles sending and formatting of individual e-mail messages through the configured SMTP servers on the system

Summary

Methods
Properties
Constants
dispatch()
dispatch_smtp()
process_emails()
send()
get_smtp_server()
write()
search_queue()
get_queue()
clear_queue()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
dispatch_phpmail()
queue_mail()
connect()
$app
$headers
$server_num
$smtp_host
$smtp_connections
$queue
N/A

Properties

$headers

$headers :

Type

$server_num

$server_num :

Type

$smtp_host

$smtp_host :

Type

$smtp_connections

$smtp_connections :

Type

$queue

$queue :

Type

Methods

dispatch()

dispatch(\apex\app\tests\EventMessageInterface  $msg)

Send an e-mail message.

Parameters

\apex\app\tests\EventMessageInterface $msg

The e-mail message to send.

dispatch_smtp()

dispatch_smtp(\apex\app\msg\objects\email_message  $email)

Dispatch to SMTP

Parameters

\apex\app\msg\objects\email_message $email

The e-mail message to dispatch.

process_emails()

process_emails(string  $controller,integer  $userid,array  $condition = array(),array  $data = array())

Processes any necessary notifications. Takes in the type of notifications, and additional variables. Checks each notification against the condition, and sends any that match.

Parameters

string $controller

The notification controller / type alias of which to check.

integer $userid

The user ID# for which notifications are being processed against.

array $condition

Associative array containing details on the current request, and is checked against the condition notifications were created with.

array $data

Associatve array that is passed to the notification controller, and contains any additional information to retrieve merge variables (eg. transaction ID#, support ticket ID#, etc.)

send()

send(string  $to_email,string  $to_name,string  $from_email,string  $from_name,string  $subject,string  $message,string  $content_type = 'text/plain',string  $reply_to = '',string  $cc = '',string  $bcc = '',array  $attachments = array())

Send single e-mail message.

Send a single e-mail message vir rotating SMTP servers, or if not SMTP servers available via phpmail(). Dispatches the e-mail to a listener to take advantage of horizontal scaling with RabbitMQ.

Parameters

string $to_email

E-mail address of the recipient.

string $to_name

Full name of the recipient.

string $from_email

E-mail address of the sender.

string $from_name

Full name of the sender.

string $subject

The subject of the e-mail message.

string $message

The contents of the e-mail message to send.

string $content_type

Optional, and the content type of the e-mail message. Defaults to "text/plain".

string $reply_to

Optional, the the Reply-To e-mail address.

string $cc

Optional, and the e-mail address to CC the message to.

string $bcc

Optional, and the e-mail address to BCC the message to.

array $attachments

Optional, and associative array of file attachments to include, keys are the filename and value is contents of file.

get_smtp_server()

get_smtp_server()

Get the next SMTP server to send from

write()

write(mixed  $sock,string  $message): string

Write line to a SMTP connection, and return the next line given by the SMTP server.

Parameters

mixed $sock

The SMTP socket connection

string $message

The message to send to the SMTP server

Returns

string —

The one-line response from the SMTP server

search_queue()

search_queue(string  $to_email = '',string  $from_email = '',string  $subject = '',string  $message = ''): array<mixed,\apex\app\tests\EventMessageInterface>

Search the mail queue.

This will search through the queue of e-mail messages that contain all e-mails sent during testing, find any that meet your search criteria, and return them in an array. All search variables are optional.

Parameters

string $to_email

The recipient e-mail address.

string $from_email

The sender e-mail address

string $subject

Text the subject will contain

string $message

Text the message body will contain

Returns

array<mixed,\apex\app\tests\EventMessageInterface> —

An array of messages that meet the search criteria.

get_queue()

get_queue(): array

Get the current queue of messages

Returns

array —

The current queue of messages.

clear_queue()

clear_queue()

Clear the queue

dispatch_phpmail()

dispatch_phpmail(\apex\app\interfaces\msg\EmailMessageInterface  $msg)

Send e-mail via php mail() function if not SMTP is available.

Parameters

\apex\app\interfaces\msg\EmailMessageInterface $msg

The e-mail message to send.

queue_mail()

queue_mail()

Queue undeliverable mail

connect()

connect(string  $host,integer  $port,string  $username,string  $password,integer  $is_ssl): mixed

Connect to a SMTP server.

Parameters

string $host

The SMTP host

integer $port

The SMTP port

string $username

The SMTP username

string $password

The SMTP password

integer $is_ssl

A 1/0 defining whether or not to use SSL connection

Returns

mixed —

The socket connection if successful, or false otherwise.