mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Removing headers methods.
This commit is contained in:
parent
5e56f76510
commit
46c79ec4a1
2 changed files with 0 additions and 112 deletions
|
@ -547,94 +547,6 @@ class EmailComponent extends Component {
|
|||
$this->_boundary = md5(uniqid(time()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets headers for the message
|
||||
*
|
||||
* @access public
|
||||
* @param array Associative array containing headers to be set.
|
||||
*/
|
||||
function header($headers) {
|
||||
foreach ($headers as $header => $value) {
|
||||
$this->_header[] = sprintf('%s: %s', trim($header), trim($value));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create emails headers including (but not limited to) from email address, reply to,
|
||||
* bcc and cc.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _createHeader() {
|
||||
$headers = array();
|
||||
|
||||
if ($this->delivery == 'smtp') {
|
||||
$headers['To'] = implode(', ', array_map(array($this, '_formatAddress'), (array)$this->to));
|
||||
}
|
||||
$headers['From'] = $this->_formatAddress($this->from);
|
||||
|
||||
if (!empty($this->replyTo)) {
|
||||
$headers['Reply-To'] = $this->_formatAddress($this->replyTo);
|
||||
}
|
||||
if (!empty($this->return)) {
|
||||
$headers['Return-Path'] = $this->_formatAddress($this->return);
|
||||
}
|
||||
if (!empty($this->readReceipt)) {
|
||||
$headers['Disposition-Notification-To'] = $this->_formatAddress($this->readReceipt);
|
||||
}
|
||||
|
||||
if (!empty($this->cc)) {
|
||||
$headers['Cc'] = implode(', ', array_map(array($this, '_formatAddress'), (array)$this->cc));
|
||||
}
|
||||
|
||||
if (!empty($this->bcc) && $this->delivery != 'smtp') {
|
||||
$headers['Bcc'] = implode(', ', array_map(array($this, '_formatAddress'), (array)$this->bcc));
|
||||
}
|
||||
if ($this->delivery == 'smtp') {
|
||||
$headers['Subject'] = $this->_encode($this->subject);
|
||||
}
|
||||
|
||||
if ($this->messageId !== false) {
|
||||
if ($this->messageId === true) {
|
||||
$headers['Message-ID'] = '<' . String::UUID() . '@' . env('HTTP_HOST') . '>';
|
||||
} else {
|
||||
$headers['Message-ID'] = $this->messageId;
|
||||
}
|
||||
}
|
||||
|
||||
$date = $this->date;
|
||||
if ($date == false) {
|
||||
$date = date(DATE_RFC2822);
|
||||
}
|
||||
$headers['Date'] = $date;
|
||||
|
||||
$headers['X-Mailer'] = $this->xMailer;
|
||||
|
||||
if (!empty($this->headers)) {
|
||||
foreach ($this->headers as $key => $val) {
|
||||
$headers['X-' . $key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($this->attachments)) {
|
||||
$this->_createBoundary();
|
||||
$headers['MIME-Version'] = '1.0';
|
||||
$headers['Content-Type'] = 'multipart/mixed; boundary="' . $this->_boundary . '"';
|
||||
$headers[] = 'This part of the E-mail should never be seen. If';
|
||||
$headers[] = 'you are reading this, consider upgrading your e-mail';
|
||||
$headers[] = 'client to a MIME-compatible client.';
|
||||
} elseif ($this->sendAs === 'text') {
|
||||
$headers['Content-Type'] = 'text/plain; charset=' . $this->charset;
|
||||
} elseif ($this->sendAs === 'html') {
|
||||
$headers['Content-Type'] = 'text/html; charset=' . $this->charset;
|
||||
} elseif ($this->sendAs === 'both') {
|
||||
$headers['Content-Type'] = 'multipart/alternative; boundary="alt-' . $this->_boundary . '"';
|
||||
}
|
||||
|
||||
$headers['Content-Transfer-Encoding'] = '7bit';
|
||||
|
||||
$this->header($headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the message by seeing if it has attachments.
|
||||
*
|
||||
|
|
|
@ -85,29 +85,6 @@ class EmailTestComponent extends EmailComponent {
|
|||
return $this->_smtpConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience setter for testing.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setHeaders($headers) {
|
||||
$this->_header += $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience getter for testing.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function getHeaders() {
|
||||
if (empty($this->_header)) {
|
||||
return array();
|
||||
}
|
||||
return $this->_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience setter for testing.
|
||||
*
|
||||
|
@ -1164,7 +1141,6 @@ HTMLBLOC;
|
|||
$this->assertNull($this->Controller->EmailTest->date);
|
||||
$this->assertNull($this->Controller->EmailTest->subject);
|
||||
$this->assertNull($this->Controller->EmailTest->additionalParams);
|
||||
$this->assertIdentical($this->Controller->EmailTest->getHeaders(), array());
|
||||
$this->assertNull($this->Controller->EmailTest->getBoundary());
|
||||
$this->assertIdentical($this->Controller->EmailTest->getMessage(), array());
|
||||
$this->assertNull($this->Controller->EmailTest->smtpError);
|
||||
|
|
Loading…
Add table
Reference in a new issue