Permalink
Browse files

Added the ability to return a message URI after sending a message so …

…we can link it back to the Postmark page.
  • Loading branch information...
1 parent 6f878e0 commit 0ca7f822bcbfa17eb477a507c19343ca1687fbf1 Beau West committed Mar 14, 2012
Showing with 29 additions and 0 deletions.
  1. +29 −0 Postmark.php
View
@@ -396,6 +396,35 @@ public function send()
}
/**
+ * Returns a URI for the last message sent.
+ * @return mixed
+ */
+ public function &messageUri()
+ {
+ $address = null;
+ if(!defined('POSTMARKAPP_SERVER_ID') || empty($this->lastReponse))
+ {
+ return false;
+ }
+
+ $postmarkAddress = 'https://postmarkapp.com/servers/' . POSTMARKAPP_SERVER_ID . '/messages/';
+
+ if(is_array($this->lastReponse))
+ {
+ $address = array();
+ foreach($this->lastReponse as $response)
+ {
+ $address[] = $postmarkAddress . $response->MessageID;
+ }
+ }
+ else
+ {
+ $address = $postmarkAddress . $this->lastReponse->MessageID;
+ }
+ return $address;
+ }
+
+ /**
* Specify subject
*
* @param string $subject E-mail subject

0 comments on commit 0ca7f82

Please sign in to comment.