From 34d8203262666032969fbe81b2c5a223dc87ccd2 Mon Sep 17 00:00:00 2001 From: Iain Cambridge Date: Tue, 13 May 2014 14:58:12 +0100 Subject: [PATCH] Removed pointless try and catch. None of the functions threw an exception and it was just rethrowing. Also Exception didn't exist in that namespace --- src/Mailgun/Mailgun.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Mailgun/Mailgun.php b/src/Mailgun/Mailgun.php index fa342d7..c34ab74 100644 --- a/src/Mailgun/Mailgun.php +++ b/src/Mailgun/Mailgun.php @@ -38,14 +38,11 @@ class Mailgun{ return $this->post("$workingDomain/messages", $postData, $postFiles); } else if(is_string($postFiles)){ - try{ - $tempFile = tempnam(sys_get_temp_dir(), "MG_TMP_MIME"); - $fileHandle = fopen($tempFile, "w"); - fwrite($fileHandle, $postFiles); - } - catch(Exception $ex){ - throw $ex; - } + + $tempFile = tempnam(sys_get_temp_dir(), "MG_TMP_MIME"); + $fileHandle = fopen($tempFile, "w"); + fwrite($fileHandle, $postFiles); + $result = $this->post("$workingDomain/messages.mime", $postData, array("message" => $tempFile)); fclose($fileName); unlink($fileName);