-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add names support in the emails, fix sending plain text emails with a…
…ttachement
- Loading branch information
Ivan Kerin
committed
Sep 12, 2013
1 parent
6bc3746
commit 8f38454
Showing
3 changed files
with
58 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,13 +36,13 @@ public function test_send() | |
$api = new Api('POSTMARK_API_TEST'); | ||
|
||
$response = $api->send(array( | ||
'From' => '[email protected]', | ||
'From' => 'Mark Smith <[email protected]>', | ||
'To' => '[email protected],[email protected],[email protected]', | ||
'Subject' => 'Test', | ||
'HtmlBody' => '<b>Hello</b>', | ||
'TextBody' => 'Hello', | ||
'ReplyTo' => '[email protected]', | ||
'Cc' => '[email protected],[email protected]', | ||
'Cc' => '[email protected],Tom Smith <[email protected]>', | ||
'Bcc' => '[email protected],[email protected]', | ||
'Attachments' => array( | ||
array( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,11 +37,11 @@ public function test_send() | |
$api->expects($this->at(2)) | ||
->method('send') | ||
->with($this->equalTo(array( | ||
'From' => '[email protected]', | ||
'To' => '[email protected]', | ||
'Cc' => '[email protected],[email protected]', | ||
'Bcc' => '[email protected],[email protected]', | ||
'ReplyTo' => '[email protected]', | ||
'From' => 'John Smith <[email protected]>', | ||
'To' => 'Paul Smith <[email protected]>', | ||
'Cc' => 'Jane Smith <[email protected]>,[email protected]', | ||
'Bcc' => 'Gale Smith <[email protected]>,Mark Smith <[email protected]>', | ||
'ReplyTo' => 'Tom Smith <[email protected]>', | ||
'Subject' => 'Test Big', | ||
'TextBody' => 'Text Part', | ||
'HtmlBody' => 'HTML Part', | ||
|
@@ -54,6 +54,22 @@ public function test_send() | |
) | ||
))); | ||
|
||
$api->expects($this->at(3)) | ||
->method('send') | ||
->with($this->equalTo(array( | ||
'From' => '[email protected]', | ||
'To' => '[email protected]', | ||
'Subject' => 'Test Big', | ||
'TextBody' => 'Text Body', | ||
'Attachments' => array( | ||
array( | ||
'Name' => 'logo_black.png', | ||
'Content' => 'iVBORw0KGgoAAAANSUhEUgAAAHsAAAASCAYAAAB7PKHtAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABR0RVh0Q3JlYXRpb24gVGltZQAyLzcvMTOGU1gaAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAA+ZJREFUaIHtmeF12zYQx3/W83drA6kTRJkg7ATWBqUniDJB6AmiTlB6gsoThNmA2YDeQJmg/XDAI3S8A0G7TZ22//fwLIL3B+6Aw90RvsJGDeyBHbAJfV+BATgBrZLfAcfkuTVkLOR4dWgeBqAP+gzq3TGM7aFPuOcZblWgq4VOzXdw5LaInVWY4yb0f0HsatVYFv8Q+G8Ut8vpuAtCf8y0AXGGiEq9bzLKpcjxmgI9vPm6Qt5Z2WFxPV3P5B0qle0cmVIbe2euuoA7GDYWEXWrArdS/Y23Ago5XrNQl/TUdQu5+wzX0zUu5NqxbW6zl+rYK76lT27D19eBqEMUwFPoi5PsEYeIYebBMeLvwgOX4XrPGLYA3iP6pjIR98nvdeBukr4jEtKXYoOEycnJmUELvFN9D4xpJer4S3j3xHiwInRaeGAM2XsubaxJ0lXHpSe02B67xs4hleI3BtdCjteod5XBPzj8TvVbODnje1yta9qsfOydbD3O2bENJB932CH87Iyf4oA6xDs1+YAfmiL0+wp70eeQ4zXYm6H1sBa1w96wFHtnbo+rddVNb4i32drJvMJtDkv3jBXTENQwrVA15t5/L7xEj5fa8KSeTxQsOHCrxtDpsxRfkt8bZMOP+FGCFVOPfE7u+qdQq+fuO3FB0tlj8hzzdw4la30MulhNf/qluEHqls/IaT+hbLxm6o2v5dRq6IWqmIZAz1Er9VwzFj8A33hesVkHXiwUb5HI2DjyJWu9Y1q8WWiD7Hvn/W1oh6Bnf+0IvkZ8mnn/yPTzJOLzDLdZrI3gzLjh8SvlI+WOUxL2c4gFWIOk4xtD5k3QZ7syFFv6GfEa8Ej+ti2He56fN8G+HfMiTKeeK0OmDTrFNocBsX0NvAU+ILedKW6CzKQq1QqVoMKubF/Ca8hXvwOyMJUxbjfD7ZEN3hZwS3Ql6OLN1yVyvXpn6Z/iuXtTa+4K8cK0snxH/nOgDgq/NAQtxc/AVdK2jCF0Dleq7RAbh79QvwPTE2VBR5EW2+nmsEZs9yJxqztW4a/e3E+IE6RF0T70/caYBzxsEY/1Wu5O+UdFzN/fZuRaLp1igxyehnHT4w1alxnnhBzM34NcrfjaqS7GasmHPqtVgVst5HUOr0n0aZy5StAp7hJ43JyuKWp8eyN2XN6AlbZYC+ibw5K2jSc7KllSEIB4751hxP+QQ/PrjEyPOE9J2AdZ73vGkH1ECrG5KBJxBwwr1dkAPyGX6tZAT4ghO8r+X/1fRUn+jv+2vMvIfkU2dcs0ksQC06q+Ix6RCr0FKVZy2DLmgZ7Xe+Hyb0EV/p7x7wxy2CH52uT/Cao6KpIl3Ep0AAAAAElFTkSuQmCC', | ||
'ContentType' => 'image/png' | ||
), | ||
) | ||
))); | ||
|
||
$message = Swift_Message::newInstance(); | ||
|
||
$message->setFrom('[email protected]'); | ||
|
@@ -74,18 +90,28 @@ public function test_send() | |
|
||
$message = Swift_Message::newInstance(); | ||
|
||
$message->setFrom('[email protected]'); | ||
$message->setTo('[email protected]'); | ||
$message->setReplyTo('[email protected]'); | ||
$message->setFrom('[email protected]', 'John Smith'); | ||
$message->setTo('[email protected]', 'Paul Smith'); | ||
$message->setReplyTo('[email protected]', 'Tom Smith'); | ||
$message->setSubject('Test Big'); | ||
$message->setCc(array('[email protected]', '[email protected]')); | ||
$message->setBcc(array('[email protected]', '[email protected]')); | ||
$message->setCc(array('[email protected]' => 'Jane Smith', '[email protected]')); | ||
$message->setBcc(array('[email protected]' => 'Gale Smith', '[email protected]' => 'Mark Smith')); | ||
$message->addPart('HTML Part', 'text/html'); | ||
$message->addPart('Text Part', 'text/plain'); | ||
$message->attach(Swift_Attachment::fromPath(__DIR__.'/../../test_data/logo_black.png')); | ||
|
||
$mailer->send($message); | ||
|
||
$message = Swift_Message::newInstance(); | ||
|
||
$message->setFrom('[email protected]'); | ||
$message->setTo('[email protected]'); | ||
$message->setSubject('Test Big'); | ||
$message->setBody('Text Body'); | ||
$message->attach(Swift_Attachment::fromPath(__DIR__.'/../../test_data/logo_black.png')); | ||
|
||
$mailer->send($message); | ||
|
||
$transport->stop(); | ||
|
||
$transport->registerPlugin($this->getMock('Swift_Events_EventListener')); | ||
|