@@ -18,7 +18,7 @@ |
||
18 | 18 | public static function getFullEmail($email, $name = "") |
19 | 19 | { |
20 | 20 | if (!empty($name)) { |
21 | - return "\"".$name."\" <".$email.">"; |
|
21 | + return "\"" . $name . "\" <" . $email . ">"; |
|
22 | 22 | } else { |
23 | 23 | return $email; |
24 | 24 | } |
@@ -24,8 +24,8 @@ |
||
24 | 24 | $message = $mail->getFullMessageEnvelope(); |
25 | 25 | |
26 | 26 | // Fix BCC header because PHPMailer does not send to us |
27 | - foreach ((array) $envelope->getBCC() as $bccEmail) { |
|
28 | - $message = 'Bcc: '.$bccEmail."\n".$message; |
|
27 | + foreach ((array)$envelope->getBCC() as $bccEmail) { |
|
28 | + $message = 'Bcc: ' . $bccEmail . "\n" . $message; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | //Send the message (which must be base 64 encoded): |
@@ -52,25 +52,25 @@ discard block |
||
52 | 52 | $mail->setFrom($from["email"], $from["name"]); |
53 | 53 | |
54 | 54 | // Add Recipients |
55 | - foreach ((array) $envelope->getTo() as $toItem) { |
|
55 | + foreach ((array)$envelope->getTo() as $toItem) { |
|
56 | 56 | $to = Util::decomposeEmail($toItem); |
57 | 57 | $mail->addAddress($to["email"], $to["name"]); |
58 | 58 | } |
59 | 59 | |
60 | 60 | // Add Carbon Copy |
61 | - foreach ((array) $envelope->getCC() as $ccItem) { |
|
61 | + foreach ((array)$envelope->getCC() as $ccItem) { |
|
62 | 62 | $cc = Util::decomposeEmail($ccItem); |
63 | 63 | $mail->addCC($cc["email"], $cc["name"]); |
64 | 64 | } |
65 | 65 | |
66 | 66 | // Add Blind Carbon Copy |
67 | - foreach ((array) $envelope->getBCC() as $bccItem) { |
|
67 | + foreach ((array)$envelope->getBCC() as $bccItem) { |
|
68 | 68 | $bcc = Util::decomposeEmail($bccItem); |
69 | 69 | $mail->addBCC($bcc["email"], $bcc["name"]); |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Attachments |
73 | - foreach ((array) $envelope->getAttachments() as $name => $value) { |
|
73 | + foreach ((array)$envelope->getAttachments() as $name => $value) { |
|
74 | 74 | $mail->addAttachment($value['content'], $name, 'base64', $value['content-type']); |
75 | 75 | } |
76 | 76 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if (!empty($this->connection->getUsername())) { |
93 | 93 | $mail->SMTPAuth = true; |
94 | 94 | $mail->Username = $this->connection->getUsername(); // SMTP account username |
95 | - $mail->Password = $this->connection->getPassword(); // SMTP account password |
|
95 | + $mail->Password = $this->connection->getPassword(); // SMTP account password |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | if (!$mail->Send()) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function addAttachment($contentName, $filePath, $contentType) |
53 | 53 | { |
54 | - $this->_attachment[$contentName] = [ 'content' => $filePath, 'content-type' => $contentType]; |
|
54 | + $this->_attachment[$contentName] = ['content' => $filePath, 'content-type' => $contentType]; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | public function getFrom() |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public static function mailerFactory(MailConnection $connection) |
189 | 189 | { |
190 | 190 | $protocol = $connection->getProtocol(); |
191 | - if (in_array($protocol, [ 'smtp', 'ssl', 'tls'])) { |
|
191 | + if (in_array($protocol, ['smtp', 'ssl', 'tls'])) { |
|
192 | 192 | $mail = new PHPMailerWrapper($connection); |
193 | 193 | } elseif ($protocol === "ses") { |
194 | 194 | $mail = new AmazonSesWrapper($connection); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } elseif ($protocol === "sendmail") { |
198 | 198 | $mail = new SendMailWrapper(); |
199 | 199 | } else { |
200 | - throw new InvalidArgumentException("Connection '".$connection->getProtocol()."' is not valid"); |
|
200 | + throw new InvalidArgumentException("Connection '" . $connection->getProtocol() . "' is not valid"); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return $mail; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | $params["async"] = true; |
53 | 53 | $params["ip_pool"] = "Main Pool"; |
54 | 54 | |
55 | - $sendTo = array_unique(array_merge((array) $envelope->getTo(), (array) $envelope->getCC())); |
|
55 | + $sendTo = array_unique(array_merge((array)$envelope->getTo(), (array)$envelope->getCC())); |
|
56 | 56 | foreach ($sendTo as $email) { |
57 | - $params['message']['to'][] = [ 'email' => $email, 'type' => 'to']; |
|
57 | + $params['message']['to'][] = ['email' => $email, 'type' => 'to']; |
|
58 | 58 | } |
59 | 59 | |
60 | - foreach ((array) $envelope->getBCC() as $email) { |
|
60 | + foreach ((array)$envelope->getBCC() as $email) { |
|
61 | 61 | $params['message']['bcc_address'] = $email; |
62 | 62 | } |
63 | 63 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | curl_setopt($ch, CURLOPT_HTTPHEADER, |
73 | 73 | array( |
74 | 74 | 'Accept: application/json', |
75 | - 'Content-Length: '.strlen($json)) |
|
75 | + 'Content-Length: ' . strlen($json)) |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | $result = curl_exec($ch); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } else { |
83 | 83 | $resultJson = json_decode($result, true); |
84 | 84 | if ($resultJson[0]['status'] == 'error') { |
85 | - throw new Exception('Mandrill: '.$resultJson[0]['message']); |
|
85 | + throw new Exception('Mandrill: ' . $resultJson[0]['message']); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |