Mail.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to
[email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Mail
- Version
- $Id$
Package: Zend_MailClass for sending an email.
- Parent(s)
- \Zend_Mime_Message
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
string $_type = null
Content type of the message
Default valuenull
Details- Type
- string
boolean $hasAttachments = false
Flag: whether or not email has attachments
Default valuefalse
Details- Type
- boolean
Methods
_addRecipientAndHeader(string $headerName, string $email, string $name) : void
Helper function for adding a recipient and the corresponding header
ParametersName | Type | Description |
---|
$headerName | string | |
---|
$email | string | |
---|
$name | string | |
---|
_clearHeader(string $headerName) : void
Clear header from the message
ParametersName | Type | Description |
---|
$headerName | string | |
---|
Details- Deprecated
- use public method directly
_storeHeader(string $headerName, string $value, bool $append = false) : void
Add a header to the message
Adds a header to this message. If append is true and the header already
exists, raises a flag indicating that the header should be appended.
ParametersName | Type | Description |
---|
$headerName | string | |
---|
$value | string | |
---|
$append | bool | |
---|
addBcc(string | array $email) : \Zend_Mail
Adds Bcc recipient, $email can be an array, or a single string address
ParametersName | Type | Description |
---|
$email | string | array | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
addCc(string | array $email, string $name = '') : \Zend_Mail
Adds Cc-header and recipient, $email can be an array, or a single string address
ParametersName | Type | Description |
---|
$email | string | array | |
---|
$name | string | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
addHeader(string $name, string $value, boolean $append = false) : \Zend_Mail
Add a custom header to the message
ParametersName | Type | Description |
---|
$name | string | |
---|
$value | string | |
---|
$append | boolean | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
Throws addTo(string | array $email, string $name = '') : \Zend_Mail
Adds To-header and recipient, $email can be an array, or a single string address
ParametersName | Type | Description |
---|
$email | string | array | |
---|
$name | string | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
clearDate() : \Zend_Mail
Clears the formatted date from the message
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
clearFrom() : \Zend_Mail
Clears the sender from the mail
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
clearHeader(string $headerName) : \Zend_Mail
Clear header from the message
ParametersName | Type | Description |
---|
$headerName | string | |
---|
Returns clearMessageId() : \Zend_Mail
Clears the Message-ID from the message
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
clearRecipients() : \Zend_Mail
Clears list of recipient email addresses
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
clearReplyTo() : \Zend_Mail
Clears the current Reply-To address from the message
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
clearReturnPath() : \Zend_Mail
Clears the current Return-Path address from the message
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
clearSubject() : \Zend_Mail
Clears the encoded subject from the message
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
createAttachment(string $body, string $mimeType = \Zend_Mime::TYPE_OCTETSTREAM, string $disposition = \Zend_Mime::DISPOSITION_ATTACHMENT, string $encoding = \Zend_Mime::ENCODING_BASE64, string $filename = null) : \Zend_Mime_Part
Creates a Zend_Mime_Part attachment
Attachment is automatically added to the mail object after creation. The
attachment object is returned to allow for further manipulation.
ParametersName | Type | Description |
---|
$body | string | |
---|
$mimeType | string | |
---|
$disposition | string | |
---|
$encoding | string | |
---|
$filename | string | OPTIONAL A filename for the attachment |
---|
ReturnsType | Description |
---|
\Zend_Mime_Part | Newly created Zend_Mime_Part object (to allow
advanced settings) |
getBodyHtml(bool $htmlOnly = false) : false | \Zend_Mime_Part | string
Return Zend_Mime_Part representing body HTML
ParametersName | Type | Description |
---|
$htmlOnly | bool | Whether to return the body HTML only, or the MIME part; defaults to false, the MIME part |
---|
Returns getBodyText( $textOnly = false) : false | \Zend_Mime_Part | string
Return text body Zend_Mime_Part or string
ParametersName | Type | Description |
---|
$textOnly | | |
---|
Returns getDefaultFrom() : null | array
staticReturns the default sender of the mail
ReturnsType | Description |
---|
null | array | Null if none was set. |
getDefaultReplyTo() : null | array
staticReturns the default Reply-To Address and Name of the mail
ReturnsType | Description |
---|
null | array | Null if none was set. |
getDefaultTransport() : void
staticGets the default mail transport for all following uses of
unittests
Details- Todo
- Allow passing a string to indicate the transport to load
- Todo
- Allow passing in optional options for the transport to load
getEncodingOfHeaders() : string
Return encoding of mail headers
ReturnsDetails- Deprecated
- use {@link getHeaderEncoding()} instead
getHeaderEncoding() : string
Return the encoding of mail headers
Either Zend_Mime::ENCODING_QUOTEDPRINTABLE or Zend_Mime::ENCODING_BASE64
ReturnsgetRecipients() : array
Return list of recipient email addresses
ReturnsType | Description |
---|
array | (of strings) |
getReplyTo() : string | null
Returns the current Reply-To address of the message
ReturnsType | Description |
---|
string | null | Reply-To address, null when not set |
getReturnPath() : string
Returns the current Return-Path address of the message
If no Return-Path header is set, returns the value of {@link $_from}.
Returnssend(\Zend_Mail_Transport_Abstract $transport = null) : \Zend_Mail
Sends this email using the given transport or a previously
set DefaultTransport or the internal mail function if no
default transport had been set.
ParametersReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
setBodyHtml(string $html, string $charset = null, string $encoding = \Zend_Mime::ENCODING_QUOTEDPRINTABLE) : \Zend_Mail
Sets the HTML body for the message
ParametersName | Type | Description |
---|
$html | string | |
---|
$charset | string | |
---|
$encoding | string | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
setBodyText(string $txt, string $charset = null, string $encoding = \Zend_Mime::ENCODING_QUOTEDPRINTABLE) : \Zend_Mail
Sets the text body for the message.
ParametersName | Type | Description |
---|
$txt | string | |
---|
$charset | string | |
---|
$encoding | string | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
setDefaultFrom(string $email, $name = null) : void
staticSets Default From-email and name of the message
ParametersName | Type | Description |
---|
$email | string | |
---|
$name | | |
---|
setDefaultReplyTo(string $email, $name = null) : void
staticSets Default ReplyTo-address and -name of the message
ParametersName | Type | Description |
---|
$email | string | |
---|
$name | | |
---|
setDefaultTransport(\Zend_Mail_Transport_Abstract $transport) : void
staticSets the default mail transport for all following uses of
Zend_Mail::send();
ParametersDetails- Todo
- Allow passing a string to indicate the transport to load
- Todo
- Allow passing in optional options for the transport to load
setEncodingOfHeaders(string $encoding) : \Zend_Mail
Set the encoding of mail headers
ParametersName | Type | Description |
---|
$encoding | string | |
---|
ReturnsDetails- Deprecated
- Use {@link setHeaderEncoding()} instead.
setFrom(string $email, string $name = null) : \Zend_Mail
Sets From-header and sender of the message
ParametersName | Type | Description |
---|
$email | string | |
---|
$name | string | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
Throws setFromToDefaultFrom() : \Zend_Mail
Sets From-name and -email based on the defaults
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
setHeaderEncoding(string $encoding) : \Zend_Mail
Set the encoding of mail headers
ParametersName | Type | Description |
---|
$encoding | string | Zend_Mime::ENCODING_QUOTEDPRINTABLE or Zend_Mime::ENCODING_BASE64 |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
setMessageId(boolean | string $id = true) : \Zend_Mail
Sets the Message-ID of the message
ParametersName | Type | Description |
---|
$id | boolean | string | true :Auto
false :No set
null :No set
string:Sets given string (Angle brackets is not necessary) |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
Throws setMimeBoundary(string $boundary) : \Zend_Mail
Set an arbitrary mime boundary for the message
If not set, Zend_Mime will generate one.
ParametersName | Type | Description |
---|
$boundary | string | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
setReplyToFromDefault() : \Zend_Mail
Sets ReplyTo-name and -email based on the defaults
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
setReturnPath(string $email) : \Zend_Mail
Sets the Return-Path header of the message
ParametersName | Type | Description |
---|
$email | string | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
Throws setSubject(string $subject) : \Zend_Mail
Sets the subject of the message
ParametersName | Type | Description |
---|
$subject | string | |
---|
ReturnsType | Description |
---|
\Zend_Mail | Provides fluent interface |
Throws setType(string $type) : \Zend_Mail
Should only be used for manually setting multipart content types.
ParametersName | Type | Description |
---|
$type | string | Content type |
---|
ReturnsType | Description |
---|
\Zend_Mail | Implements fluent interface |
Throws