|
| __construct ($charset=null) |
|
| getCharset () |
|
| setType ($type) |
|
| getType () |
|
| setMimeBoundary ($boundary) |
|
| getMimeBoundary () |
|
| getEncodingOfHeaders () |
|
| getHeaderEncoding () |
|
| setEncodingOfHeaders ($encoding) |
|
| setHeaderEncoding ($encoding) |
|
| setBodyText ($txt, $charset=null, $encoding=Zend_Mime::ENCODING_QUOTEDPRINTABLE) |
|
| getBodyText ($textOnly=false) |
|
| setBodyHtml ($html, $charset=null, $encoding=Zend_Mime::ENCODING_QUOTEDPRINTABLE) |
|
| getBodyHtml ($htmlOnly=false) |
|
| addAttachment (Zend_Mime_Part $attachment) |
|
| createAttachment ($body, $mimeType=Zend_Mime::TYPE_OCTETSTREAM, $disposition=Zend_Mime::DISPOSITION_ATTACHMENT, $encoding=Zend_Mime::ENCODING_BASE64, $filename=null) |
|
| getPartCount () |
|
| addTo ($email, $name='') |
|
| addCc ($email, $name='') |
|
| addBcc ($email) |
|
| getRecipients () |
|
| clearHeader ($headerName) |
|
| clearRecipients () |
|
| setFrom ($email, $name=null) |
|
| setReplyTo ($email, $name=null) |
|
| getFrom () |
|
| getReplyTo () |
|
| clearFrom () |
|
| clearReplyTo () |
|
| setFromToDefaultFrom () |
|
| setReplyToFromDefault () |
|
| setReturnPath ($email) |
|
| getReturnPath () |
|
| clearReturnPath () |
|
| setSubject ($subject) |
|
| getSubject () |
|
| clearSubject () |
|
| setDate ($date=null) |
|
| getDate () |
|
| clearDate () |
|
| setMessageId ($id=true) |
|
| getMessageId () |
|
| clearMessageId () |
|
| createMessageId () |
|
| addHeader ($name, $value, $append=false) |
|
| getHeaders () |
|
| send ($transport=null) |
|
| getParts () |
|
| setParts ($parts) |
|
| addPart (Zend_Mime_Part $part) |
|
| isMultiPart () |
|
| setMime (Zend_Mime $mime) |
|
| getMime () |
|
| generateMessage ($EOL=Zend_Mime::LINEEND) |
|
| getPartHeadersArray ($partnum) |
|
| getPartHeaders ($partnum, $EOL=Zend_Mime::LINEEND) |
|
| getPartContent ($partnum, $EOL=Zend_Mime::LINEEND) |
|
Definition at line 52 of file Mail.php.
◆ __construct()
__construct |
( |
|
$charset = null | ) |
|
Public constructor
- Parameters
-
Definition at line 213 of file Mail.php.
215 if ($charset !=
null) {
216 $this->_charset = $charset;
◆ _addRecipientAndHeader()
_addRecipientAndHeader |
( |
|
$headerName, |
|
|
|
$email, |
|
|
|
$name |
|
) |
| |
|
protected |
Helper function for adding a recipient and the corresponding header
- Parameters
-
string | $headerName | |
string | $email | |
string | $name | |
Definition at line 557 of file Mail.php.
562 $this->_recipients[
$email] = 1;
_storeHeader($headerName, $value, $append=false)
_formatAddress($email, $name)
if(!isset($_GET['name'])) $name
◆ _clearHeader()
_clearHeader |
( |
|
$headerName | ) |
|
|
protected |
Clear header from the message
- Parameters
-
- Deprecated:
- use public method directly
Definition at line 545 of file Mail.php.
◆ _encodeHeader()
Encode header fields
Encodes header content according to RFC1522 if it contains non-printable characters.
- Parameters
-
- Returns
- string
Definition at line 502 of file Mail.php.
const ENCODING_QUOTEDPRINTABLE
static encodeQuotedPrintableHeader( $str, $charset, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND)
static encodeBase64Header( $str, $charset, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND)
◆ _filterEmail()
Filter of email data
- Parameters
-
- Returns
- string
Definition at line 1212 of file Mail.php.
1214 $rule = array(
"\r" =>
'',
◆ _filterName()
Filter of name data
- Parameters
-
- Returns
- string
Definition at line 1232 of file Mail.php.
1234 $rule = array(
"\r" =>
'',
if(!isset($_GET['name'])) $name
◆ _filterOther()
Filter of other data
- Parameters
-
- Returns
- string
Definition at line 1251 of file Mail.php.
1253 $rule = array(
"\r" =>
'',
◆ _formatAddress()
_formatAddress |
( |
|
$email, |
|
|
|
$name |
|
) |
| |
|
protected |
Formats e-mail address
- Parameters
-
- Returns
- string
Definition at line 1268 of file Mail.php.
1274 if ($encodedName ===
$name && strcspn(
$name,
'()<>[]:;@\\,.') != strlen(
$name)) {
if(!isset($_GET['name'])) $name
◆ _storeHeader()
_storeHeader |
( |
|
$headerName, |
|
|
|
$value, |
|
|
|
$append = false |
|
) |
| |
|
protected |
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.
- Parameters
-
string | $headerName | |
string | $value | |
bool | $append | |
Definition at line 525 of file Mail.php.
527 if (isset($this->_headers[$headerName])) {
528 $this->_headers[$headerName][] =
$value;
530 $this->_headers[$headerName] = array(
$value);
534 $this->_headers[$headerName][
'append'] =
true;
◆ addAttachment()
Adds an existing attachment to the mail message
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
Definition at line 443 of file Mail.php.
446 $this->hasAttachments =
true;
addPart(Zend_Mime_Part $part)
◆ addBcc()
Adds Bcc recipient, $email can be an array, or a single string address
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
Definition at line 615 of file Mail.php.
621 foreach (
$email as $recipient) {
_addRecipientAndHeader($headerName, $email, $name)
◆ addCc()
addCc |
( |
|
$email, |
|
|
|
$name = '' |
|
) |
| |
Adds Cc-header and recipient, $email can be an array, or a single string address
- Parameters
-
string | array | $email | |
string | $name | |
- Returns
- Zend_Mail Provides fluent interface
Definition at line 596 of file Mail.php.
602 foreach (
$email as $n => $recipient) {
_addRecipientAndHeader($headerName, $email, $name)
if(!isset($_GET['name'])) $name
◆ addHeader()
addHeader |
( |
|
$name, |
|
|
|
$value, |
|
|
|
$append = false |
|
) |
| |
Add a custom header to the message
- Parameters
-
string | $name | |
string | $value | |
boolean | $append | |
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
- See also
- Zend_Mail_Exception
Definition at line 1139 of file Mail.php.
1141 $prohibit = array(
'to',
'cc',
'bcc',
'from',
'subject',
1142 'reply-to',
'return-path',
1143 'date',
'message-id',
1145 if (in_array(strtolower(
$name), $prohibit)) {
1149 #require_once 'Zend/Mail/Exception.php';
_storeHeader($headerName, $value, $append=false)
if(!isset($_GET['name'])) $name
◆ addTo()
addTo |
( |
|
$email, |
|
|
|
$name = '' |
|
) |
| |
Adds To-header and recipient, $email can be an array, or a single string address
- Parameters
-
string | array | $email | |
string | $name | |
- Returns
- Zend_Mail Provides fluent interface
Definition at line 574 of file Mail.php.
580 foreach (
$email as $n => $recipient) {
582 $this->_to[] = $recipient;
_addRecipientAndHeader($headerName, $email, $name)
if(!isset($_GET['name'])) $name
◆ clearDate()
Clears the formatted date from the message
- Returns
- Zend_Mail Provides fluent interface
Definition at line 1030 of file Mail.php.
1032 $this->_date =
null;
◆ clearDefaultFrom()
static clearDefaultFrom |
( |
| ) |
|
|
static |
Clears the default sender from the mail
- Returns
- void
Definition at line 794 of file Mail.php.
796 self::$_defaultFrom =
null;
◆ clearDefaultReplyTo()
static clearDefaultReplyTo |
( |
| ) |
|
|
static |
Clears the default ReplyTo-address and -name from the mail
- Returns
- void
Definition at line 845 of file Mail.php.
847 self::$_defaultReplyTo =
null;
◆ clearDefaultTransport()
static clearDefaultTransport |
( |
| ) |
|
|
static |
Clear the default transport property
Definition at line 203 of file Mail.php.
205 self::$_defaultTransport =
null;
◆ clearFrom()
Clears the sender from the mail
- Returns
- Zend_Mail Provides fluent interface
Definition at line 746 of file Mail.php.
◆ clearHeader()
clearHeader |
( |
|
$headerName | ) |
|
Clear header from the message
- Parameters
-
- Returns
- Zend_Mail Provides fluent inter
Definition at line 644 of file Mail.php.
646 if (isset($this->_headers[$headerName])){
647 unset($this->_headers[$headerName]);
◆ clearMessageId()
Clears the Message-ID from the message
- Returns
- Zend_Mail Provides fluent interface
Definition at line 1088 of file Mail.php.
1090 $this->_messageId =
null;
◆ clearRecipients()
Clears list of recipient email addresses
- Returns
- Zend_Mail Provides fluent interface
Definition at line 657 of file Mail.php.
659 $this->_recipients = array();
660 $this->_to = array();
◆ clearReplyTo()
Clears the current Reply-To address from the message
- Returns
- Zend_Mail Provides fluent interface
Definition at line 759 of file Mail.php.
761 $this->_replyTo =
null;
◆ clearReturnPath()
Clears the current Return-Path address from the message
- Returns
- Zend_Mail Provides fluent interface
Definition at line 913 of file Mail.php.
915 $this->_returnPath =
null;
◆ clearSubject()
Clears the encoded subject from the message
- Returns
- Zend_Mail Provides fluent interface
Definition at line 959 of file Mail.php.
961 $this->_subject =
null;
◆ createAttachment()
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.
- Parameters
-
string | $body | |
string | $mimeType | |
string | $disposition | |
string | $encoding | |
string | $filename | OPTIONAL A filename for the attachment |
- Returns
- Zend_Mime_Part Newly created Zend_Mime_Part object (to allow advanced settings)
Definition at line 465 of file Mail.php.
473 $mp->encoding = $encoding;
474 $mp->type = $mimeType;
475 $mp->disposition = $disposition;
476 $mp->filename = $filename;
addAttachment(Zend_Mime_Part $attachment)
◆ createMessageId()
Creates the Message-ID
- Returns
- string
Definition at line 1101 of file Mail.php.
1105 if ($this->_from !==
null) {
1107 }
elseif (isset($_SERVER[
'REMOTE_ADDR'])) {
1108 $user = $_SERVER[
'REMOTE_ADDR'];
1115 if ($this->_recipients !== array()) {
1116 $recipient = array_rand($this->_recipients);
1118 $recipient =
'unknown';
1121 if (isset($_SERVER[
"SERVER_NAME"])) {
1122 $hostName = $_SERVER[
"SERVER_NAME"];
1124 $hostName = php_uname(
'n');
1127 return sha1($time .
$user . $rand . $recipient) .
'@' . $hostName;
elseif(isset( $params[ 'redirect_parent']))
◆ getBodyHtml()
getBodyHtml |
( |
|
$htmlOnly = false | ) |
|
Return Zend_Mime_Part representing body HTML
- Parameters
-
bool | $htmlOnly | Whether to return the body HTML only, or the MIME part; defaults to false, the MIME part |
- Returns
- false|Zend_Mime_Part|string
Definition at line 427 of file Mail.php.
429 if ($htmlOnly && $this->_bodyHtml) {
431 return $body->getContent();
◆ getBodyText()
getBodyText |
( |
|
$textOnly = false | ) |
|
Return text body Zend_Mime_Part or string
- Parameters
-
bool | $textOnly | Whether to return just the body text content or the MIME part; defaults to false, the MIME part |
- Returns
- false|Zend_Mime_Part|string
Definition at line 386 of file Mail.php.
388 if ($textOnly && $this->_bodyText) {
390 return $body->getContent();
◆ getCharset()
Return charset string
- Returns
- string
Definition at line 225 of file Mail.php.
◆ getDate()
Returns the formatted date of the message
- Returns
- string
Definition at line 1020 of file Mail.php.
◆ getDefaultFrom()
static getDefaultFrom |
( |
| ) |
|
|
static |
Returns the default sender of the mail
- Returns
- null|array Null if none was set.
Definition at line 784 of file Mail.php.
◆ getDefaultReplyTo()
static getDefaultReplyTo |
( |
| ) |
|
|
static |
Returns the default Reply-To Address and Name of the mail
- Returns
- null|array Null if none was set.
Definition at line 835 of file Mail.php.
◆ getDefaultTransport()
static getDefaultTransport |
( |
| ) |
|
|
static |
Gets the default mail transport for all following uses of unittests
- Todo:
Allow passing a string to indicate the transport to load
Allow passing in optional options for the transport to load
Definition at line 195 of file Mail.php.
static $_defaultTransport
◆ getEncodingOfHeaders()
◆ getFrom()
Returns the sender of the mail
- Returns
- string
Definition at line 726 of file Mail.php.
◆ getHeaderEncoding()
◆ getHeaders()
Return mail headers
- Returns
- array
Definition at line 1165 of file Mail.php.
◆ getMessageId()
Returns the Message-ID of the message
- Returns
- string
Definition at line 1077 of file Mail.php.
◆ getMimeBoundary()
Return the boundary string used for the message
- Returns
- string
Definition at line 288 of file Mail.php.
◆ getPartCount()
Return a count of message parts
- Returns
- integer
Definition at line 488 of file Mail.php.
490 return count($this->_parts);
◆ getRecipients()
Return list of recipient email addresses
- Returns
- array (of strings)
Definition at line 633 of file Mail.php.
635 return array_keys($this->_recipients);
◆ getReplyTo()
Returns the current Reply-To address of the message
- Returns
- string|null Reply-To address, null when not set
Definition at line 736 of file Mail.php.
◆ getReturnPath()
Returns the current Return-Path address of the message
If no Return-Path header is set, returns the value of $_from.
- Returns
- string
Definition at line 899 of file Mail.php.
901 if (
null !== $this->_returnPath) {
◆ getSubject()
Returns the encoded subject of the message
- Returns
- string
Definition at line 949 of file Mail.php.
◆ getType()
Get content type of the message
- Returns
- string
Definition at line 263 of file Mail.php.
◆ send()
send |
( |
|
$transport = null | ) |
|
Sends this email using the given transport or a previously set DefaultTransport or the internal mail function if no default transport had been set.
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
Definition at line 1178 of file Mail.php.
1180 if ($transport ===
null) {
1182 #require_once 'Zend/Mail/Transport/Sendmail.php'; 1189 if ($this->_date ===
null) {
1193 if(
null === $this->_from &&
null !== self::getDefaultFrom()) {
1197 if(
null === $this->_replyTo &&
null !== self::getDefaultReplyTo()) {
1201 $transport->send($this);
static $_defaultTransport
◆ setBodyHtml()
Sets the HTML body for the message
- Parameters
-
string | $html | |
string | $charset | |
string | $encoding | |
- Returns
- Zend_Mail Provides fluent interface
Definition at line 404 of file Mail.php.
406 if ($charset ===
null) {
411 $mp->encoding = $encoding;
414 $mp->charset = $charset;
416 $this->_bodyHtml = $mp;
◆ setBodyText()
Sets the text body for the message.
- Parameters
-
string | $txt | |
string | $charset | |
string | $encoding | |
- Returns
- Zend_Mail Provides fluent interface
Definition at line 362 of file Mail.php.
364 if ($charset ===
null) {
369 $mp->encoding = $encoding;
372 $mp->charset = $charset;
374 $this->_bodyText = $mp;
◆ setDate()
Sets Date-header
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
- See also
- Zend_Mail_Exception
-
Zend_Mail_Exception
-
Zend_Mail_Exception
Definition at line 975 of file Mail.php.
977 if ($this->_date ===
null) {
978 if ($date ===
null) {
980 }
else if (is_int($date)) {
981 $date = date(
'r', $date);
982 }
else if (is_string($date)) {
983 $date = strtotime($date);
984 if ($date ===
false || $date < 0) {
988 #require_once 'Zend/Mail/Exception.php'; 990 'strtotime()-compatible');
992 $date = date(
'r', $date);
994 $date = $date->get(Zend_Date::RFC_2822);
999 #require_once 'Zend/Mail/Exception.php'; 1000 throw new Zend_Mail_Exception(__METHOD__ .
' only accepts UNIX timestamps, Zend_Date objects, ' .
1001 ' and strtotime()-compatible strings');
1003 $this->_date = $date;
1009 #require_once 'Zend/Mail/Exception.php';
_storeHeader($headerName, $value, $append=false)
◆ setDefaultFrom()
static setDefaultFrom |
( |
|
$email, |
|
|
|
$name = null |
|
) |
| |
|
static |
Sets Default From-email and name of the message
- Parameters
-
string | $email | |
string | $name | optional |
- Returns
- void
Definition at line 774 of file Mail.php.
776 self::$_defaultFrom = array(
'email' =>
$email,
'name' =>
$name);
if(!isset($_GET['name'])) $name
◆ setDefaultReplyTo()
static setDefaultReplyTo |
( |
|
$email, |
|
|
|
$name = null |
|
) |
| |
|
static |
Sets Default ReplyTo-address and -name of the message
- Parameters
-
string | $email | |
string | $name | optional |
- Returns
- void
Definition at line 825 of file Mail.php.
827 self::$_defaultReplyTo = array(
'email' =>
$email,
'name' =>
$name);
if(!isset($_GET['name'])) $name
◆ setDefaultTransport()
Sets the default mail transport for all following uses of Zend_Mail::send();
- Todo:
Allow passing a string to indicate the transport to load
Allow passing in optional options for the transport to load
- Parameters
-
Definition at line 183 of file Mail.php.
185 self::$_defaultTransport = $transport;
◆ setEncodingOfHeaders()
setEncodingOfHeaders |
( |
|
$encoding | ) |
|
◆ setFrom()
setFrom |
( |
|
$email, |
|
|
|
$name = null |
|
) |
| |
Sets From-header and sender of the message
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
- See also
- Zend_Mail_Exception
Definition at line 677 of file Mail.php.
679 if (
null !== $this->_from) {
683 #require_once 'Zend/Mail/Exception.php';
_storeHeader($headerName, $value, $append=false)
_formatAddress($email, $name)
if(!isset($_GET['name'])) $name
◆ setFromToDefaultFrom()
Sets From-name and -email based on the defaults
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
Definition at line 805 of file Mail.php.
808 #require_once 'Zend/Mail/Exception.php'; 810 'No default From Address set to use');
813 $this->
setFrom($from[
'email'], $from[
'name']);
setFrom($email, $name=null)
◆ setHeaderEncoding()
setHeaderEncoding |
( |
|
$encoding | ) |
|
Set the encoding of mail headers
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
- See also
- Zend_Mail_Exception
Definition at line 336 of file Mail.php.
342 if (!in_array($encoding, $allowed)) {
346 #require_once 'Zend/Mail/Exception.php'; 349 $this->_headerEncoding = $encoding;
const ENCODING_QUOTEDPRINTABLE
◆ setMessageId()
setMessageId |
( |
|
$id = true | ) |
|
Sets the Message-ID of the message
- Parameters
-
boolean | string | $id | true :Auto false :No set null :No set string:Sets given string (Angle brackets is not necessary) |
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
- See also
- Zend_Mail_Exception
Definition at line 1049 of file Mail.php.
1051 if (
$id ===
null ||
$id ===
false) {
1057 if ($this->_messageId ===
null) {
1059 $this->_messageId =
$id;
1060 $this->
_storeHeader(
'Message-Id',
'<' . $this->_messageId .
'>');
1065 #require_once 'Zend/Mail/Exception.php'; elseif(isset( $params[ 'redirect_parent']))
_storeHeader($headerName, $value, $append=false)
◆ setMimeBoundary()
setMimeBoundary |
( |
|
$boundary | ) |
|
Set an arbitrary mime boundary for the message
If not set, Zend_Mime will generate one.
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
Definition at line 276 of file Mail.php.
278 $this->_mimeBoundary = $boundary;
◆ setReplyTo()
setReplyTo |
( |
|
$email, |
|
|
|
$name = null |
|
) |
| |
Set Reply-To Header
- Parameters
-
- Returns
- Zend_Mail
- Exceptions
-
- See also
- Zend_Mail_Exception
Definition at line 703 of file Mail.php.
705 if (
null !== $this->_replyTo) {
709 #require_once 'Zend/Mail/Exception.php';
_storeHeader($headerName, $value, $append=false)
_formatAddress($email, $name)
if(!isset($_GET['name'])) $name
◆ setReplyToFromDefault()
setReplyToFromDefault |
( |
| ) |
|
Sets ReplyTo-name and -email based on the defaults
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
Definition at line 856 of file Mail.php.
858 if($replyTo ===
null) {
859 #require_once 'Zend/Mail/Exception.php'; 861 'No default Reply-To Address set to use');
864 $this->
setReplyTo($replyTo[
'email'], $replyTo[
'name']);
static getDefaultReplyTo()
setReplyTo($email, $name=null)
◆ setReturnPath()
Sets the Return-Path header of the message
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
- See also
- Zend_Mail_Exception
Definition at line 876 of file Mail.php.
878 if ($this->_returnPath ===
null) {
880 $this->_returnPath =
$email;
886 #require_once 'Zend/Mail/Exception.php';
_storeHeader($headerName, $value, $append=false)
◆ setSubject()
Sets the subject of the message
- Parameters
-
- Returns
- Zend_Mail Provides fluent interface
- Exceptions
-
- See also
- Zend_Mail_Exception
Definition at line 928 of file Mail.php.
930 if ($this->_subject ===
null) {
938 #require_once 'Zend/Mail/Exception.php';
_storeHeader($headerName, $value, $append=false)
◆ setType()
Set content type
Should only be used for manually setting multipart content types.
- Parameters
-
- Returns
- Zend_Mail Implements fluent interface
- Exceptions
-
- See also
- Zend_Mail_Exception
Definition at line 239 of file Mail.php.
246 if (!in_array(
$type, $allowed)) {
250 #require_once 'Zend/Mail/Exception.php'; 254 $this->_type =
$type;
const MULTIPART_ALTERNATIVE
◆ $_bodyHtml
◆ $_bodyText
◆ $_charset
◆ $_date
◆ $_defaultFrom
◆ $_defaultReplyTo
◆ $_defaultTransport
$_defaultTransport = null |
|
staticprotected |
◆ $_from
◆ $_headerEncoding
◆ $_headers
◆ $_messageId
◆ $_mimeBoundary
◆ $_recipients
◆ $_replyTo
◆ $_returnPath
◆ $_subject
◆ $_to
◆ $_type
◆ $hasAttachments
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Mail.php