eZPublishCommunityProject(LegacyStack)  2013.5
eZMail Class Reference

Mail handler. More...

Public Member Functions

 addBcc ($email, $name=false)
 
 addCc ($email, $name=false)
 
 addExtraHeader ($headerName, $headerValue)
 
 addReceiver ($email, $name=false)
 
 allowedCharsets ()
 
 bccElements ()
 
 bccReceiverTextList ($convert=true)
 
 body ($convert=true)
 
 ccElements ()
 
 ccReceiverTextList ($convert=true)
 
 composeEmailItems ($items, $join=true, $key=false, $convert=true)
 
 composeEmailName ($item, $key=false, $convert=true)
 
 contentCharset ()
 
 contentDisposition ()
 
 contentTransferEncoding ()
 
 contentType ()
 
 convertHeaderText ($text)
 
 convertText ($text, $isHeader=false)
 
 encodeMimeHeader ($str)
 
 extraHeaders ()
 
 eZMail ()
 
 headers ($parameters=array())
 
 headerText ($parameters=array())
 
 headerTextList ($parameters=array())
 
 isAllowedCharset ($charset)
 
 messageID ()
 
 mimeVersion ()
 
 outputCharset ()
 
 receiverElements ()
 
 receiverEmailText ($convert=true)
 
 receiverText ($convert=true)
 
 receiverTextList ($convert=true)
 
 references ()
 
 replyTo ($convert=true)
 
 sender ($convert=true)
 
 senderText ($convert=true)
 
 setBccElements ($newBcc)
 
 setBody ($newBody)
 
 setCcElements ($newCc)
 
 setContentType ($type=false, $charset=false, $transferEncoding=false, $disposition=false, $boundary=false)
 
 setExtraHeader ($headerName, $headerValue)
 
 setExtraHeaders ($headers)
 
 setMessageID ($newMessageID)
 
 setMIMEVersion ($version)
 
 setReceiver ($email, $name=false)
 
 setReceiverElements ($toElements)
 
 setReceiverText ($text)
 
 setReferences ($newReference)
 
 setReplyTo ($email, $name=false)
 
 setSender ($email, $name=false)
 
 setSenderText ($text)
 
 setSubject ($newSubject)
 
 setUserAgent ($agent)
 
 subject ($convert=true)
 
 usedCharset ()
 
 userAgent ($convert=true)
 

Static Public Member Functions

static blankNewlines ($text)
 
static contentString ($content)
 
static extractEmail ($text, &$email, &$name)
 
static lineSeparator ()
 
static & splitList ($emails)
 
static stripEmail ($address)
 
static validate ($address)
 

Public Attributes

 $BccElements
 
 $BodyText
 
 $CcElements
 
 $ContentType
 
 $ExtraHeaders
 
 $From
 
 $Mail
 
 $MessageID
 
 $MIMEVersion
 
 $ReceiverElements
 
 $ReplyTo
 
 $Subject
 
 $TextCodec
 
 $UserAgent
 
const REGEXP = '(((\"[^\"\f\n\r\t\v\b]+\")|([A-Za-z0-9_\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[A-Za-z0-9_\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]{2,})))'
 

Detailed Description

Mail handler.

Class for storing the details about en email and providing text serialization.

Note
It's important to note that most methods that return values do an automatic conversion if not specified.

This class will be deprecated in the next eZ Publish release, and replaced with ezcMail from eZ Components.

The eZMail class was used like this (with old smtp class which will be removed): $mail = new eZMail(); $mail->setSender( $fromEmail, $yourName ); $mail->setReceiver( $receiversEmail, $receiversName ); $mail->setSubject( $subject );

$smtp = new smtp( $parameters ); $smtpConnected = $smtp->connect(); if ( $smtpConnected ) { $result = $smtp->send( $sendData ); }

Since the smtp class will be removed, ezcMailSmtpTransport from eZ Components can be used temporarily instead (the class eZSMTPTransport is using ezcMailSmtpTransport instead of smtp as well):

$smtp = new ezcMailSmtpTransport( $host, $username, $password, $port ); $smtp->send( $mail->Mail );

Instead of the code above, ezcMail will be used together with the SMTP transport from eZ Components (MTA transport will work as well):

$mail = new ezpMail(); $mail->from = new ezcMailAddress( $fromEmail, $yourName, $charset ); $mail->addTo( new ezcMailAddress( $receiversEmail, $receiversName, $charset ) ); $mail->subject = $subject;

$smtp = new ezcMailSmtpTransport( $host, $username, $password, $port ); $smtp->send( $mail );

Member Function Documentation

eZMail::addBcc (   $email,
  $name = false 
)

Adds a new Bcc address.

Deprecated:
eZMail::addCc (   $email,
  $name = false 
)

Adds a new Cc address.

Deprecated:
eZMail::addExtraHeader (   $headerName,
  $headerValue 
)

Adds the headers $headerName with header value $headerValue to the extra headers.

Deprecated:

Referenced by setExtraHeader().

eZMail::addReceiver (   $email,
  $name = false 
)

Adds a new receiver address.

Deprecated:
eZMail::allowedCharsets ( )
Returns
an array with charsets that can be used directly as output charsets.
Deprecated:

Referenced by isAllowedCharset().

eZMail::bccElements ( )

Returns the addresses which should get a blind carbon copy.

Deprecated:
eZMail::bccReceiverTextList (   $convert = true)
static eZMail::blankNewlines (   $text)
static
Returns
a text which does not contain newlines, newlines are converted to spaces.
Deprecated:

Referenced by headerText(), and headerTextList().

eZMail::body (   $convert = true)
eZMail::ccElements ( )

Returns the addresses which should get a carbon copy.

Deprecated:
eZMail::ccReceiverTextList (   $convert = true)

Returns the receiver cc addresses as an array with texts.

Deprecated:
eZMail::composeEmailItems (   $items,
  $join = true,
  $key = false,
  $convert = true 
)

Composes an email text out of all items in $items and returns it. All items are comma separated.

Deprecated:

Referenced by bccReceiverTextList(), ccReceiverTextList(), headers(), receiverEmailText(), receiverText(), and receiverTextList().

eZMail::composeEmailName (   $item,
  $key = false,
  $convert = true 
)

Composes a text out of the email and name and returns it.

Example: John Doe john@.nosp@m.doe..nosp@m.com or just john@.nosp@m.doe..nosp@m.com

Deprecated:

Referenced by composeEmailItems(), headers(), and senderText().

eZMail::contentCharset ( )
Returns
the charset for this email, this is normally taken from the internal charset.
See Also
usedCharset
Deprecated:

Referenced by convertHeaderText(), convertText(), encodeMimeHeader(), and usedCharset().

eZMail::contentDisposition ( )
Returns
the content disposition, normally this is inline.
Deprecated:
static eZMail::contentString (   $content)
static
Returns
the header content as a simple string, will deflate arrays.
See Also
blankNewLines
Deprecated:

Referenced by headerText(), and headerTextList().

eZMail::contentTransferEncoding ( )
Returns
the content transfer encoding, normally this is 8bit.
Deprecated:
eZMail::contentType ( )
Returns
the content type for this email, this is normally text/plain.
Deprecated:
eZMail::convertHeaderText (   $text)

Calls convertText with $isHeader set to true.

Deprecated:

Referenced by composeEmailName(), replyTo(), sender(), senderText(), subject(), and userAgent().

eZMail::convertText (   $text,
  $isHeader = false 
)

Converts the text $text to a suitable output format.

Note
Header conversion is not supported yet, for now it will only return original text when $isHeader is set to true.
Deprecated:

Referenced by body().

eZMail::encodeMimeHeader (   $str)

Encodes $str using mb_encode_mimeheader() if it is available, or does base64 encoding of a header if not.

Deprecated:

Referenced by convertHeaderText().

static eZMail::extractEmail (   $text,
$email,
$name 
)
static

Extracts email addresses from $text.

Deprecated:

Referenced by eZSMTPTransport\sendMail(), setReceiverText(), and setSenderText().

eZMail::extraHeaders ( )

Return the extra headers

Deprecated:
eZMail::eZMail ( )

Constructs a new eZMail object.

eZMail::headers (   $parameters = array())
Returns
an array with headers, each header item is an associative array with the keys name and content. content will either be a string or an array with strings.

The parameter $parameters contains optional parameters, they can be:

  • exclude-headers - Array of header names which will not be included in the result array.
    See Also
    contentString, blankNewLines
    Deprecated:

Referenced by headerText(), and headerTextList().

eZMail::headerText (   $parameters = array())

Composes a text field out of all the headers and returns it. The parameter $parameters will be passed to the headers() function.

Deprecated:

Referenced by eZFileTransport\sendMail(), and eZSendmailTransport\sendMail().

eZMail::headerTextList (   $parameters = array())

Extracts all headers and generates a text string out of it. The parameter $parameters will be passed to the headers() function.

Deprecated:
eZMail::isAllowedCharset (   $charset)
Returns
true if the charset $charset is allowed as output charset.
See Also
allowedCharsets.
Deprecated:

Referenced by convertText(), and usedCharset().

static eZMail::lineSeparator ( )
static

Returns the line ending.

Deprecated:

Referenced by encodeMimeHeader(), headerText(), and setBody().

eZMail::messageID ( )

Returns the message ID format : <number@serverID> Read in the RFC's if you want to know more about it..

Deprecated:
eZMail::mimeVersion ( )
Returns
the MIME version for this email, normally this is 1.0.
Note
The value is returned as a string.
Deprecated:
eZMail::outputCharset ( )
Returns
the default output charset.
Deprecated:

Referenced by convertText(), encodeMimeHeader(), and usedCharset().

eZMail::receiverElements ( )

Returns the receiver addresses.

Deprecated:
eZMail::receiverEmailText (   $convert = true)

Returns the receiver addresses as text with only the email address.

Deprecated:

Referenced by eZSendmailTransport\sendMail().

eZMail::receiverText (   $convert = true)

Returns the receiver addresses as text.

Deprecated:
eZMail::receiverTextList (   $convert = true)

Returns the receiver addresses as an array with texts.

Deprecated:
eZMail::references ( )

Returns the messageID that this message is a reply to.

Deprecated:
eZMail::replyTo (   $convert = true)

Returns the receiver address.

Deprecated:
eZMail::sender (   $convert = true)

Returns the sender address.

Deprecated:

Referenced by eZFileTransport\sendMail(), and eZSendmailTransport\sendMail().

eZMail::senderText (   $convert = true)

Returns the sender address as text.

Deprecated:

Referenced by eZSMTPTransport\sendMail().

eZMail::setBccElements (   $newBcc)

Sets the bcc addresses.

Deprecated:
eZMail::setBody (   $newBody)

Sets the body.

Deprecated:
eZMail::setCcElements (   $newCc)

Sets the cc addresses.

Deprecated:
eZMail::setContentType (   $type = false,
  $charset = false,
  $transferEncoding = false,
  $disposition = false,
  $boundary = false 
)

Sets the various content variables, any parameter which is set to something other than false will overwrite the old value.

Deprecated:

Referenced by eZMail().

eZMail::setExtraHeader (   $headerName,
  $headerValue 
)

Similar to addExtraHeader() but will overwrite existing entries.

Deprecated:
eZMail::setExtraHeaders (   $headers)

Sets the extra headers to $headers.

Deprecated:
eZMail::setMessageID (   $newMessageID)

Sets the message ID. This is a server setting only so BE CAREFUL WITH THIS.

Deprecated:
eZMail::setMIMEVersion (   $version)

Sets the MIME version to $version.

Deprecated:
eZMail::setReceiver (   $email,
  $name = false 
)

Sets the receiver address.

Note
This will remove all other receivers
See Also
addReceiver, setReceiverElements
Deprecated:
eZMail::setReceiverElements (   $toElements)

Sets the receiver addresses.

Deprecated:
eZMail::setReceiverText (   $text)

Sets the receiver address, the email and name will be extracted from $text.

Note
This will remove all other receivers
See Also
addReceiver, setReceiverElements
Deprecated:
eZMail::setReferences (   $newReference)

Sets the messageID that this message is a reply to.

Deprecated:
eZMail::setReplyTo (   $email,
  $name = false 
)

Sets the receiver address.

Deprecated:
eZMail::setSender (   $email,
  $name = false 
)

Sets the sender address.

Deprecated:
eZMail::setSenderText (   $text)

Sets the sender address, the email and name will be extracted from $text.

Deprecated:

Referenced by eZFileTransport\sendMail(), eZSMTPTransport\sendMail(), and eZSendmailTransport\sendMail().

eZMail::setSubject (   $newSubject)

Sets the subject of the mail.

Deprecated:
eZMail::setUserAgent (   $agent)

Sets the user agent for the email to $agent.

Deprecated:
static& eZMail::splitList (   $emails)
static

Splits a list of email addresses into an array where each entry is an email address.

Deprecated:
static eZMail::stripEmail (   $address)
static

Static function for extracting an e-mail from text

Returns the first valid e-mail in address, returns false if no e-mail addresses found

Deprecated:
eZMail::subject (   $convert = true)

Returns the subject.

Deprecated:

Referenced by headers(), and eZSendmailTransport\sendMail().

eZMail::userAgent (   $convert = true)
Returns
the user agent for this email, the user agent is automatically created if not specfied.
Deprecated:

Member Data Documentation

eZMail::$BccElements

Referenced by bccElements().

eZMail::$BodyText

Referenced by body().

eZMail::$CcElements

Referenced by ccElements().

eZMail::$ContentType
eZMail::$ExtraHeaders

Referenced by extraHeaders(), and headers().

eZMail::$From

Referenced by sender().

eZMail::$Mail
eZMail::$MessageID

Referenced by messageID().

eZMail::$MIMEVersion

Referenced by mimeVersion().

eZMail::$ReceiverElements

Referenced by receiverElements().

eZMail::$ReplyTo

Referenced by replyTo().

eZMail::$Subject

Referenced by subject().

eZMail::$TextCodec
eZMail::$UserAgent

Referenced by userAgent().

const eZMail::REGEXP = '(((\"[^\"\f\n\r\t\v\b]+\")|([A-Za-z0-9_\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[A-Za-z0-9_\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]{2,})))'

Referenced by extractEmail(), stripEmail(), and validate().


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