Open Journal Systems  3.3.0
Mail Class Reference
Inheritance diagram for Mail:
DataObject MailTemplate MassMail SubmissionMailTemplate ArticleMailTemplate

Public Member Functions

 __construct ()
 
 addAttachment ($filePath, $fileName='', $contentType='', $contentDisposition='attachment')
 
 addBcc ($email, $name='')
 
 addCc ($email, $name='')
 
 addHeader ($name, $content)
 
 addPrivateParam ($name, $value)
 
 addRecipient ($email, $name='')
 
 addReplyTo ($email, $name='')
 
 clearAllRecipients ()
 
 getAddressArrayString ($addresses, $includeNames=true, $send=false)
 
getAttachments ()
 
 getBccs ()
 
 getBccString ()
 
 getBody ()
 
 getCcs ()
 
 getCcString ()
 
 getContentType ()
 
 getEnvelopeSender ()
 
 getFrom ()
 
 getFromString ($send=false)
 
 getHeaders ()
 
 getRecipients ()
 
 getRecipientString ()
 
 getReplyTo ()
 
 getReplyToString ($send=false)
 
 getSubject ()
 
 hasAttachments ()
 
 promoteCcsIfNoRecipients ()
 
 send ()
 
 setBccs ($bccs)
 
 setBody ($body)
 
 setCcs ($ccs)
 
 setContentType ($contentType)
 
 setEnvelopeSender ($envelopeSender)
 
 setFrom ($email, $name='')
 
 setHeaders (&$headers)
 
 setPrivateParams ($privateParams)
 
 setRecipients ($recipients)
 
 setReplyTo ($email, $name='')
 
 setSubject ($subject)
 
- Public Member Functions inherited from DataObject
 addSupportedMetadataAdapter ($metadataAdapter)
 
 extractMetadata ($metadataSchema)
 
 getAdditionalMetadataFieldNames ()
 
getAllData ()
 
 getDAO ()
 
getData ($key, $locale=null)
 
 getHasLoadableAdapters ()
 
 getId ()
 
 getLocaleMetadataFieldNames ()
 
 getLocalizedData ($key, $preferredLocale=null)
 
 getMetadataFieldNames ($translated=true)
 
 getSetMetadataFieldNames ($translated=true)
 
 getSupportedExtractionAdapters ()
 
 getSupportedInjectionAdapters ()
 
 getSupportedMetadataSchemas ()
 
 hasData ($key, $locale=null)
 
 injectMetadata ($metadataDescription)
 
 removeSupportedMetadataAdapter ($metadataSchemaName)
 
 setAllData (&$data)
 
 setData ($key, $value, $locale=null)
 
 setHasLoadableAdapters ($hasLoadableAdapters)
 
 setId ($id)
 
 unsetData ($key, $locale=null)
 
 upcastTo ($targetObject)
 

Static Public Member Functions

static encodeDisplayName ($displayName, $send=false)
 

Data Fields

 $privateParams
 
- Data Fields inherited from DataObject
 $_data = array()
 
 $_extractionAdaptersLoaded = false
 
 $_hasLoadableAdapters = false
 
 $_injectionAdaptersLoaded = false
 
 $_metadataExtractionAdapters = array()
 
 $_metadataInjectionAdapters = array()
 

Detailed Description

Class defining basic operations for handling and sending emails.

Definition at line 23 of file Mail.inc.php.

Constructor & Destructor Documentation

◆ __construct()

Mail::__construct ( )

Constructor.

Reimplemented from DataObject.

Definition at line 33 of file Mail.inc.php.

References Config\getVar(), and setEnvelopeSender().

Member Function Documentation

◆ addAttachment()

Mail::addAttachment (   $filePath,
  $fileName = '',
  $contentType = '',
  $contentDisposition = 'attachment' 
)

Adds a file attachment to the email.

Parameters
$filePathstring complete path to the file to attach
$fileNamestring attachment file name (optional)
$contentTypestring attachment content type (optional)
$contentDispositionstring attachment content disposition, inline or attachment (optional, default attachment)

Definition at line 261 of file Mail.inc.php.

References DataObject\getData(), PKPString\mime_content_type(), and DataObject\setData().

◆ addBcc()

Mail::addBcc (   $email,
  $name = '' 
)

Add a blind carbon copy (BCC) recipient to the message.

Parameters
$emailstring
$nameoptional

Definition at line 162 of file Mail.inc.php.

References DataObject\getData(), and DataObject\setData().

Referenced by MailTemplate\send().

◆ addCc()

Mail::addCc (   $email,
  $name = '' 
)

Add a carbon-copy (CC) recipient to the message.

Parameters
$emailstring
$namestring optional

Definition at line 132 of file Mail.inc.php.

References DataObject\getData(), and DataObject\setData().

◆ addHeader()

Mail::addHeader (   $name,
  $content 
)

Add an SMTP header to the message.

Parameters
$namestring
$contentstring

Definition at line 217 of file Mail.inc.php.

References DataObject\getData(), and DataObject\setData().

◆ addPrivateParam()

Mail::addPrivateParam (   $name,
  $value 
)

Add a private parameter to this email. Private parameters are replaced just before sending and are never available via getBody etc.

Definition at line 46 of file Mail.inc.php.

◆ addRecipient()

Mail::addRecipient (   $email,
  $name = '' 
)

Add a recipient.

Parameters
$emailstring
$namestring optional

Definition at line 63 of file Mail.inc.php.

References DataObject\getData(), and DataObject\setData().

Referenced by MassMail\send().

◆ addReplyTo()

Mail::addReplyTo (   $email,
  $name = '' 
)

Add a reply-to for the message.

Parameters
$emailstring
$namestring optional

Definition at line 336 of file Mail.inc.php.

References DataObject\getData(), and DataObject\setData().

◆ clearAllRecipients()

Mail::clearAllRecipients ( )

Clear all recipients for this message (To, CC, and BCC).

Definition at line 206 of file Mail.inc.php.

References setBccs(), setCcs(), and setRecipients().

Referenced by MassMail\send().

◆ encodeDisplayName()

static Mail::encodeDisplayName (   $displayName,
  $send = false 
)
static

Encode a display name for proper inclusion with an email address.

Parameters
$displayNamestring
$sendboolean True to encode the results for sending
Returns
string

Definition at line 591 of file Mail.inc.php.

References PKPString\encode_mime_header(), and PKPString\regexp_match().

Referenced by getAddressArrayString(), and PKPSubmission\getAuthorEmails().

◆ getAddressArrayString()

Mail::getAddressArrayString (   $addresses,
  $includeNames = true,
  $send = false 
)

Return a string from an array of (name, email) pairs.

Parameters
$includeNamesboolean
Returns
string;

Definition at line 412 of file Mail.inc.php.

References encodeDisplayName().

Referenced by getBccString(), getCcString(), getRecipientString(), and getReplyToString().

◆ getAttachments()

& Mail::getAttachments ( )

Get the attachments currently on the message.

Returns
array

Definition at line 290 of file Mail.inc.php.

References DataObject\getData().

Referenced by hasAttachments(), and send().

◆ getBccs()

Mail::getBccs ( )

Get the blind carbon copy (BCC) recipients for the message

Returns
array

Definition at line 175 of file Mail.inc.php.

References DataObject\getData().

Referenced by getBccString(), and send().

◆ getBccString()

Mail::getBccString ( )

Return a string containing the Bcc recipients.

Returns
string

Definition at line 456 of file Mail.inc.php.

References getAddressArrayString(), and getBccs().

Referenced by SubmissionMailTemplate\log().

◆ getBody()

Mail::getBody ( )

◆ getCcs()

Mail::getCcs ( )

Get the carbon-copy (CC) recipients for the message.

Returns
array

Definition at line 145 of file Mail.inc.php.

References DataObject\getData().

Referenced by getCcString(), promoteCcsIfNoRecipients(), and send().

◆ getCcString()

Mail::getCcString ( )

Return a string containing the Cc recipients.

Returns
string

Definition at line 448 of file Mail.inc.php.

References getAddressArrayString(), and getCcs().

Referenced by SubmissionMailTemplate\log().

◆ getContentType()

Mail::getContentType ( )

Get the message content type (MIME)

Returns
string

Definition at line 99 of file Mail.inc.php.

References DataObject\getData().

Referenced by send().

◆ getEnvelopeSender()

Mail::getEnvelopeSender ( )

Get the envelope sender (bounce address) for the message, if set. Override any set envelope sender if force_default_envelope_sender config option is in effect.

Returns
string

Definition at line 86 of file Mail.inc.php.

References DataObject\getData(), and Config\getVar().

Referenced by send().

◆ getFrom()

Mail::getFrom ( )

Get the sender of the message.

Returns
array

Definition at line 317 of file Mail.inc.php.

References DataObject\getData().

Referenced by getFromString(), and send().

◆ getFromString()

Mail::getFromString (   $send = false)

Return a string containing the from address. Override any from address if force_default_envelope_sender config option is in effect.

Returns
string

Definition at line 399 of file Mail.inc.php.

References getFrom().

Referenced by SubmissionMailTemplate\log().

◆ getHeaders()

Mail::getHeaders ( )

Get the SMTP headers for the message.

Returns
array

Definition at line 242 of file Mail.inc.php.

References DataObject\getData().

Referenced by send(), and MailTemplate\sendWithParams().

◆ getRecipients()

Mail::getRecipients ( )

Get the recipients for the message.

Returns
array

Definition at line 115 of file Mail.inc.php.

References DataObject\getData().

Referenced by getRecipientString(), promoteCcsIfNoRecipients(), MassMail\send(), and send().

◆ getRecipientString()

Mail::getRecipientString ( )

Return a string containing the recipients.

Returns
string

Definition at line 440 of file Mail.inc.php.

References getAddressArrayString(), and getRecipients().

Referenced by SubmissionMailTemplate\log().

◆ getReplyTo()

Mail::getReplyTo ( )

Get the reply-to of the message.

Returns
array

Definition at line 350 of file Mail.inc.php.

References DataObject\getData().

Referenced by getReplyToString(), and send().

◆ getReplyToString()

Mail::getReplyToString (   $send = false)

Return a string containing the reply-to addresses.

Returns
string

Definition at line 358 of file Mail.inc.php.

References getAddressArrayString(), and getReplyTo().

◆ getSubject()

Mail::getSubject ( )

Get the subject of the message.

Returns
string

Definition at line 374 of file Mail.inc.php.

References DataObject\getData().

Referenced by SubmissionMailTemplate\log(), MailTemplate\replaceParams(), MassMail\send(), send(), SubmissionMailTemplate\sendWithParams(), and MailTemplate\sendWithParams().

◆ hasAttachments()

Mail::hasAttachments ( )

Return true iff attachments are included in this message.

Returns
boolean

Definition at line 299 of file Mail.inc.php.

References getAttachments().

◆ promoteCcsIfNoRecipients()

Mail::promoteCcsIfNoRecipients ( )

If no recipients for this message, promote CC'd accounts to recipients. If recipients exist, no effect.

Returns
boolean true iff CCs were promoted

Definition at line 192 of file Mail.inc.php.

References getCcs(), getRecipients(), setCcs(), and setRecipients().

◆ send()

◆ setBccs()

Mail::setBccs (   $bccs)

Set the blind carbon copy (BCC) recipients for the message.

Parameters
$bccsarray

Definition at line 183 of file Mail.inc.php.

References DataObject\setData().

Referenced by clearAllRecipients().

◆ setBody()

Mail::setBody (   $body)

◆ setCcs()

Mail::setCcs (   $ccs)

Set the carbon-copy (CC) recipients for the message.

Parameters
$ccsarray

Definition at line 153 of file Mail.inc.php.

References DataObject\setData().

Referenced by clearAllRecipients(), and promoteCcsIfNoRecipients().

◆ setContentType()

Mail::setContentType (   $contentType)

Set the message content type (MIME)

Parameters
$contentTypestring

Definition at line 107 of file Mail.inc.php.

References DataObject\setData().

◆ setEnvelopeSender()

Mail::setEnvelopeSender (   $envelopeSender)

Set the envelope sender (bounce address) for the message, if supported.

Parameters
$envelopeSenderstring Email address

Definition at line 77 of file Mail.inc.php.

References DataObject\setData().

Referenced by __construct(), and MailTemplate\send().

◆ setFrom()

Mail::setFrom (   $email,
  $name = '' 
)

Set the sender of the message.

Parameters
$emailstring
$namestring optional

Definition at line 309 of file Mail.inc.php.

References DataObject\setData().

Referenced by MailTemplate\__construct().

◆ setHeaders()

Mail::setHeaders ( $headers)

Set the SMTP headers for the message.

Parameters
$headersarray

Definition at line 250 of file Mail.inc.php.

References DataObject\setData().

Referenced by MailTemplate\sendWithParams().

◆ setPrivateParams()

Mail::setPrivateParams (   $privateParams)

Set the entire list of private parameters.

See also
addPrivateParam

Definition at line 54 of file Mail.inc.php.

References $privateParams.

◆ setRecipients()

Mail::setRecipients (   $recipients)

Set the recipients for the message.

Parameters
$recipientsarray

Definition at line 123 of file Mail.inc.php.

References DataObject\setData().

Referenced by clearAllRecipients(), promoteCcsIfNoRecipients(), and MassMail\send().

◆ setReplyTo()

Mail::setReplyTo (   $email,
  $name = '' 
)

Set the reply-to of the message.

Parameters
$emailstring or null to clear
$namestring optional

Definition at line 326 of file Mail.inc.php.

References DataObject\setData().

◆ setSubject()

Mail::setSubject (   $subject)

Set the subject of the message.

Parameters
$subjectstring

Definition at line 366 of file Mail.inc.php.

References DataObject\setData().

Referenced by MailTemplate\__construct(), MailTemplate\replaceParams(), MassMail\send(), SubmissionMailTemplate\sendWithParams(), and MailTemplate\sendWithParams().

Field Documentation

◆ $privateParams

array Mail::$privateParams

List of key => value private parameters for this message

Definition at line 28 of file Mail.inc.php.

Referenced by setPrivateParams().


The documentation for this class was generated from the following file: