EmailArchivingUtil Class Reference

Static Public Member Functions

static resolveOwnerOfEmailMessage (ImapMessage $emailMessage)
static resolveEmailSenderFromEmailMessage (ImapMessage $emailMessage)
static resolveEmailRecipientsFromEmailMessage (ImapMessage $emailMessage)
static isMessageForwarded (ImapMessage $emailMessage)
static resolveEmailSenderFromForwardedEmailMessage (ImapMessage $emailMessage)
static getPersonsAndAccountsByEmailAddressForUser ($emailAddress, User $user)
static getPersonsAndAccountsByEmailAddress ($emailAddress, $userCanAccessContacts=false, $userCanAccessLeads=false, $userCanAccessAccounts=false)
static resolvePersonOrAccountByEmailAddress ($emailAddress, $userCanAccessContacts=false, $userCanAccessLeads=false, $userCanAccessAccounts=false)
static resolveSanitizeFromImapToUtf8 (EmailMessage $message)
static createEmailMessageSender ($senderInfo, $userCanAccessContacts, $userCanAccessLeads, $userCanAccessAccounts)
static createEmailMessageRecipient ($recipientInfo, $userCanAccessContacts, $userCanAccessLeads, $userCanAccessAccounts)
static createEmailAttachment ($attachment, $base64encoded=false)

Static Protected Member Functions

static isAttachmentExtensionAllowed ($attachmentFileName)

Detailed Description

Helper class to work with inbound emails

Definition at line 40 of file EmailArchivingUtil.php.


Member Function Documentation

static resolveOwnerOfEmailMessage ( ImapMessage emailMessage  )  [static]

For a given email find user. Function consider that user sent email to dropbox (To, CC or BCC), or forwarded email to dropbox, via his email client.

Parameters:
ImapMessage $emailMessage
Returns:
User $user

Definition at line 49 of file EmailArchivingUtil.php.

static resolveEmailSenderFromEmailMessage ( ImapMessage emailMessage  )  [static]

Get information from email message, for example sender, recipient, subject... It is quite different for forwarded messages, because we need to parse email body to get those information.

Parameters:
ImapMessage $emailMessage
string $fromAddress

Definition at line 96 of file EmailArchivingUtil.php.

static resolveEmailRecipientsFromEmailMessage ( ImapMessage emailMessage  )  [static]

Get recipient details from email message. Have to cover two cases: when message is CC-ed or BCC-ed to dropbox, and when email message is forwarded to dropbox. 1. If message is CC-ed or BCC-ed to dropbox, recipients can be exctracted from "To" field of email message 2. If message is forwarded, then email from which message is forwarded to dropbox is recipient

Parameters:
ImapMessage $emailMessage
array $emailRecipient

Definition at line 131 of file EmailArchivingUtil.php.

static isMessageForwarded ( ImapMessage emailMessage  )  [static]

Check if email message is forwarded or not, based on email subject. For works only with few emails clients: Gmail, Outlook, ThunderBird, Yahoo

Parameters:
ImapMessage $emailMessage
Returns:
boolean $isForwrded

Definition at line 196 of file EmailArchivingUtil.php.

static resolveEmailSenderFromForwardedEmailMessage ( ImapMessage emailMessage  )  [static]

Parse email to get original sender(in case of forwarded messages) For now we extract only from email and name

Parameters:
ImapMessage $emailMessage
Returns:
array $emailInfo

Definition at line 217 of file EmailArchivingUtil.php.

static getPersonsAndAccountsByEmailAddressForUser ( emailAddress,
User user 
) [static]

Given an email address and user, get the objects that match the email address filtered by the rights security for the provided user.

Parameters:
string $emailAddress
User $user
Returns:
array of objects which are either persons and/or accounts

Definition at line 247 of file EmailArchivingUtil.php.

static getPersonsAndAccountsByEmailAddress ( emailAddress,
userCanAccessContacts = false,
userCanAccessLeads = false,
userCanAccessAccounts = false 
) [static]

Get all

Parameters:
string $emailAddress
boolean $userCanAccessContacts
boolean $userCanAccessLeads
boolean $userCanAccessAccounts
Returns:
Contact || Account || User || NULL || array of objects

Definition at line 267 of file EmailArchivingUtil.php.

static resolvePersonOrAccountByEmailAddress ( emailAddress,
userCanAccessContacts = false,
userCanAccessLeads = false,
userCanAccessAccounts = false 
) [static]

Get Contact or Account or User, based on email address

Parameters:
string $emailAddress
boolean $userCanAccessContacts
boolean $userCanAccessLeads
boolean $userCanAccessAccounts
Returns:
Contact || Account || User || NULL

Definition at line 304 of file EmailArchivingUtil.php.

static resolveSanitizeFromImapToUtf8 ( EmailMessage message  )  [static]

Convert $message->subject from any mime encoded to UTF8

Parameters:
EmailMessage $message

Definition at line 357 of file EmailArchivingUtil.php.

static createEmailMessageSender ( senderInfo,
userCanAccessContacts,
userCanAccessLeads,
userCanAccessAccounts 
) [static]

Create EmailMessageSender

Parameters:
array $senderInfo
boolean $userCanAccessContacts
boolean $userCanAccessLeads
boolean $userCanAccessAccounts
Returns:
EmailMessageSender

Definition at line 370 of file EmailArchivingUtil.php.

static createEmailMessageRecipient ( recipientInfo,
userCanAccessContacts,
userCanAccessLeads,
userCanAccessAccounts 
) [static]

Create EmailMessageRecipient

Parameters:
array $recipientInfo
boolean $userCanAccessContacts
boolean $userCanAccessLeads
boolean $userCanAccessAccounts
Returns:
EmailMessageRecipient

Definition at line 402 of file EmailArchivingUtil.php.

static createEmailAttachment ( attachment,
base64encoded = false 
) [static]

Create FileModel

Parameters:
array $attachment
bool $base64encoded
Returns:
FileModel

Definition at line 434 of file EmailArchivingUtil.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Thu Oct 17 07:11:03 2019