Warning: mysql_connect(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/zurmoorg/public_html/z-header.php on line 8

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/zurmoorg/public_html/z-header.php on line 8

EmailHelper Class Reference

Inheritance diagram for EmailHelper:
ZurmoBaseEmailHelper

Public Member Functions

 init ()
 loadDefaultFromAndToAddresses ()
 loadOutboundSettingsFromUserEmailAccount (User $user, $name=null)
 setOutboundSettings ()
 sendImmediately (EmailMessage $emailMessage)
 getOutboundSettings ()
 processMessageAsFailure (EmailMessage $emailMessage, $useSQL=false)
 sendQueued ($count=null, $excludePausedCampaignMessages=true)
 send (EmailMessage &$emailMessage, $useSQL=false, $validate=true)

Static Public Member Functions

static prepareMessageContent (EmailMessage $emailMessage)
static getQueuedCount ()
static isValidFolderType (EmailMessage $emailMessage)
static updateFolderForEmailMessage (EmailMessage &$emailMessage, $useSQL, EmailFolder $folder, $validate=true)

Data Fields

const OUTBOUND_TYPE_SMTP = 'smtp'
 $outboundType = self::OUTBOUND_TYPE_SMTP
 $outboundHost
 $outboundPort = 25
 $outboundUsername
 $outboundPassword
 $outboundSecurity
 $fromName
 $fromAddress
 $htmlConverter = null
 $defaultFromAddress
 $defaultTestToAddress

Protected Member Functions

 loadOutboundSettings ()

Static Protected Member Functions

static updateFolderForEmailMessageWithSQL (EmailMessage &$emailMessage, EmailFolder $folder)
static updateFolderForEmailMessageWithORM (EmailMessage &$emailMessage, EmailFolder $folder, $validate=true)
static resolveMailerFactoryClass ()

Static Protected Attributes

static $settingsToLoad

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:
CApplicationComponent::init()

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

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

Definition at line 159 of file EmailHelper.php.

setOutboundSettings (  ) 

Set outbound settings into the database.

Definition at line 189 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.

Parameters:
EmailMessage $emailMessage
Exceptions:
NotSupportedException - if the emailMessage does not properly save.
FailedToSaveModelException 
Returns:
null

Definition at line 213 of file EmailHelper.php.

static prepareMessageContent ( EmailMessage emailMessage  )  [static]

Prepare message content.

Parameters:
EmailMessage $emailMessage
Returns:
string

Definition at line 230 of file EmailHelper.php.

getOutboundSettings (  ) 

Get outbound settings.

Returns:
array

Definition at line 275 of file EmailHelper.php.

processMessageAsFailure ( EmailMessage emailMessage,
useSQL = false 
)

Process message as failure.

Parameters:
EmailMessage $emailMessage
bool $useSQL

Reimplemented from ZurmoBaseEmailHelper.

Definition at line 321 of file EmailHelper.php.

sendQueued ( count = null,
excludePausedCampaignMessages = true 
)

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.

Parameters:
null $count
bool $excludePausedCampaignMessages
Returns:
int number of queued messages to be sent

Reimplemented from ZurmoBaseEmailHelper.

Definition at line 335 of file EmailHelper.php.

send ( EmailMessage &$  emailMessage,
useSQL = false,
validate = true 
)

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

Parameters:
EmailMessage $emailMessage
bool $useSQL
bool $validate
Returns:
bool|void
Exceptions:
FailedToSaveModelException 
NotFoundException 
NotSupportedException 

Reimplemented from ZurmoBaseEmailHelper.

Definition at line 351 of file EmailHelper.php.

static getQueuedCount (  )  [static]
Returns:
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 367 of file EmailHelper.php.

static isValidFolderType ( EmailMessage emailMessage  )  [static]

Verify if folder type of an emailMessage is valid or not.

Parameters:
EmailMessage $emailMessage
Exceptions:
NotSupportedException 

Definition at line 378 of file EmailHelper.php.

static updateFolderForEmailMessage ( EmailMessage &$  emailMessage,
useSQL,
EmailFolder folder,
validate = true 
) [static]

Update an email message's folder and save it

Parameters:
EmailMessage $emailMessage
$useSQL 
EmailFolder $folder
bool $validate
Returns:
bool|void
Exceptions:
FailedToSaveModelException 

Definition at line 398 of file EmailHelper.php.

static updateFolderForEmailMessageWithSQL ( EmailMessage &$  emailMessage,
EmailFolder folder 
) [static, protected]

Update an email message's folder and save it using SQL

Parameters:
EmailMessage $emailMessage
EmailFolder $folder
Exceptions:
NotSupportedException 

Definition at line 424 of file EmailHelper.php.

static updateFolderForEmailMessageWithORM ( EmailMessage &$  emailMessage,
EmailFolder folder,
validate = true 
) [static, protected]

Update an email message's folder and save it using ORM

Parameters:
EmailMessage $emailMessage
EmailFolder $folder
bool $validate

Definition at line 450 of file EmailHelper.php.

static resolveMailerFactoryClass (  )  [static, protected]

Resolve mailer factory class.

Returns:
string

Definition at line 462 of file EmailHelper.php.


Field Documentation

$settingsToLoad [static, protected]
Initial value:
 array(
            'outboundType',
            'outboundHost',
            'outboundPort',
            'outboundUsername',
            'outboundPassword',
            'outboundSecurity'
        )

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 Mon Mar 25 07:10:51 2019

Warning: mysql_connect(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/zurmoorg/public_html/z-footer.php on line 8

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/zurmoorg/public_html/z-footer.php on line 8