EmailHelper Class Reference

Public Member Functions

 init ()
 loadDefaultFromAndToAddresses ()
 loadOutboundSettingsFromUserEmailAccount (User $user, $name=null)
 setOutboundSettings ()
 send (EmailMessage $emailMessage)
 sendImmediately (EmailMessage $emailMessage)
 sendQueued ()
 getQueuedCount ()
 resolveFromAddressByUser (User $user)
 resolveAndGetDefaultFromAddress ()
 setDefaultFromAddress ($defaultFromAddress)
 resolveAndGetDefaultTestToAddress ()
 setDefaultTestToAddress ($defaultTestToAddress)

Static Public Member Functions

static resolveDefaultEmailAddress ($defaultEmailAddress)

Data Fields

const OUTBOUND_TYPE_SMTP = 'smtp'
 $outboundType = self::OUTBOUND_TYPE_SMTP
 $outboundPort = 25
 $htmlConverter = null

Protected Member Functions

 loadOutboundSettings ()
 processMessageAsFailure (EmailMessage $emailMessage)
 populateMailer (Mailer $mailer, EmailMessage $emailMessage)
 sendEmail (Mailer $mailer, EmailMessage $emailMessage)
 getOutboundMailer ()

Protected Attributes


Detailed Description

Component for working with outbound and inbound email transport

Definition at line 40 of file EmailHelper.php.

Member Function Documentation

init (  ) 

Called once per page load, will load up outbound settings from the database if available. (non-PHPdoc)

See also:

Definition at line 130 of file EmailHelper.php.

loadDefaultFromAndToAddresses (  ) 

Used to load defaultFromAddress and defaultTestToAddress

Definition at line 139 of file EmailHelper.php.

loadOutboundSettingsFromUserEmailAccount ( User user,
name = null 

Load user's outbound settings from user's email account or the system settings

User $user
string $name EmailAccount name or null for default name

Definition at line 177 of file EmailHelper.php.

setOutboundSettings (  ) 

Set outbound settings into the database.

Definition at line 207 of file EmailHelper.php.

send ( EmailMessage emailMessage  ) 

Send an email message. This will queue up the email to be sent by the queue sending process. If you want to send immediately, consider using

EmailMessage $emailMessage

Definition at line 231 of file EmailHelper.php.

sendImmediately ( EmailMessage emailMessage  ) 

Use this method to send immediately, instead of putting an email in a queue to be processed by a scheduled job.

EmailMessage $emailMessage
NotSupportedException - if the emailMessage does not properly save.

Definition at line 258 of file EmailHelper.php.

sendQueued (  ) 

Call this method to process all email Messages in the queue. This is typically called by a scheduled job or cron. This will process all emails in a TYPE_OUTBOX folder or TYPE_OUTBOX_ERROR folder. If the message has already been sent 3 times then it will be moved to a failure folder.

Definition at line 279 of file EmailHelper.php.

getQueuedCount (  ) 
integer count of how many emails are queued to go. This means they are in either the TYPE_OUTBOX folder or the TYPE_OUTBOX_ERROR folder.

Definition at line 403 of file EmailHelper.php.

resolveFromAddressByUser ( User user  ) 

Given a user, attempt to get the user's email address, but if it is not available, then return the default address.

See also:
User $user

Definition at line 415 of file EmailHelper.php.

Field Documentation

$settingsToLoad [protected]
Initial value:

Definition at line 104 of file EmailHelper.php.

The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Wed May 24 07:10:24 2017