-
Notifications
You must be signed in to change notification settings - Fork 0
/
PostmarkAdapter.php
51 lines (39 loc) · 1.23 KB
/
PostmarkAdapter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* This is a PostmarkAdapter that overrides the normal method of sending mail and routes ALL email through
* Postmarkapp. It is loosely coupled through an adapter and can be uncoupled by removing this plugin or commenting
* out the code below.
*/
PVMail::addAdapter('PVMail','sendEmail', function($args){
$postmark = new Postmarkapp();
if(isset($args['receiver'])) {
$postmark -> setReceiver($args['receiver']);
}
if(isset($args['subject'])) {
$postmark -> setSubject($args['subject']);
}
if(isset($args['sender'])) {
$postmark -> setSender($args['sender']);
}
if(isset($args['reply_to'])) {
$postmark -> setReplyTo($args['reply_to']);
}
if(isset($args['carboncopy'])) {
$postmark -> setCarbonCopy($args['carboncopy']);
}
if(isset($args['blindcopy'])) {
$postmark -> setBlindCopy($args['blindcopy']);
}
if(isset($args['html_message'])) {
$postmark -> setHtmlMessage($args['html_message']);
}
if(isset($args['text_message'])) {
$postmark -> setTextMessage($args['text_message']);
}
if(isset($args['headers']) && is_array($args['headers'])) {
foreach($args['headers'] as $key => $value) {
$postmark -> addHeader($key, $value);
}
}
$postmark -> send();
},array('type' => 'closure'));