Added custom header getter

This commit is contained in:
Joris Berthelot 2015-04-23 18:41:17 +02:00
parent 095193b5ed
commit 47fd54d04d
3 changed files with 38 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# ChangeLog
* Add custom header getter
* Use `application/javascript` for .js attachments
* Improve RFC2821 compliance for timelimits, especially for end-of-data
* Add Azerbaijani translations (Thanks to @mirjalal)

View File

@ -2952,6 +2952,16 @@ class PHPMailer
}
}
/**
* Returns all custom headers
*
* @return array
*/
public function getCustomHeaders()
{
return $this->CustomHeader;
}
/**
* Create a message from an HTML string.
* Automatically makes modifications for inline images and backgrounds

View File

@ -1680,6 +1680,33 @@ EOT;
'SMTP connect with options failed'
);
}
/**
* Tests the Custom header getter
*/
public function testCustomHeaderGetter()
{
$this->Mail->addCustomHeader('foo', 'bar');
$this->assertEquals(array(array('foo', 'bar')), $this->Mail->getCustomHeaders());
$this->Mail->addCustomHeader('foo', 'baz');
$this->assertEquals(array(
array('foo', 'bar'),
array('foo', 'baz')
), $this->Mail->getCustomHeaders());
$this->Mail->clearCustomHeaders();
$this->assertEmpty($this->Mail->getCustomHeaders());
$this->Mail->addCustomHeader('yux');
$this->assertEquals(array(array('yux')), $this->Mail->getCustomHeaders());
$this->Mail->addCustomHeader('Content-Type: application/json');
$this->assertEquals(array(
array('yux'),
array('Content-Type', ' application/json')
), $this->Mail->getCustomHeaders());
}
}
/**