@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function getFromAddress() |
| 64 | 64 | { |
| 65 | - if($this->sender === false) |
|
| 65 | + if ($this->sender === false) |
|
| 66 | 66 | { |
| 67 | 67 | return 'Burning Flipside <[email protected]>'; |
| 68 | 68 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function getReplyTo() |
| 108 | 108 | { |
| 109 | - if($this->replyTo === false) |
|
| 109 | + if ($this->replyTo === false) |
|
| 110 | 110 | { |
| 111 | 111 | return $this->getFromAddress(); |
| 112 | 112 | } |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | * @param string $email The email address to send from |
| 150 | 150 | * @param string $name The name to associate with the from address |
| 151 | 151 | */ |
| 152 | - public function setFromAddress($email, $name=false) |
|
| 152 | + public function setFromAddress($email, $name = false) |
|
| 153 | 153 | { |
| 154 | 154 | $address = $email; |
| 155 | - if($name !== false) |
|
| 155 | + if ($name !== false) |
|
| 156 | 156 | { |
| 157 | 157 | $address = $name.' <'.$email.'>'; |
| 158 | 158 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string $email The email address to send to |
| 166 | 166 | * @param string $name The name to associate with the address |
| 167 | 167 | */ |
| 168 | - public function addToAddress($email, $name=false) |
|
| 168 | + public function addToAddress($email, $name = false) |
|
| 169 | 169 | { |
| 170 | 170 | $this->addAddress($this->to, $email, $name); |
| 171 | 171 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param string $email The email address to send to |
| 177 | 177 | * @param string $name The name to associate with the address |
| 178 | 178 | */ |
| 179 | - public function addCCAddress($email, $name=false) |
|
| 179 | + public function addCCAddress($email, $name = false) |
|
| 180 | 180 | { |
| 181 | 181 | $this->addAddress($this->cc, $email, $name); |
| 182 | 182 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param string $email The email address to send to |
| 188 | 188 | * @param string $name The name to associate with the address |
| 189 | 189 | */ |
| 190 | - public function addBCCAddress($email, $name=false) |
|
| 190 | + public function addBCCAddress($email, $name = false) |
|
| 191 | 191 | { |
| 192 | 192 | $this->addAddress($this->bcc, $email, $name); |
| 193 | 193 | } |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | * @param string $email The email address to send to |
| 200 | 200 | * @param string $name The name to associate with the address |
| 201 | 201 | */ |
| 202 | - protected function addAddress(&$list, $email, $name=false) |
|
| 202 | + protected function addAddress(&$list, $email, $name = false) |
|
| 203 | 203 | { |
| 204 | 204 | $address = $email; |
| 205 | - if($name !== false) |
|
| 205 | + if ($name !== false) |
|
| 206 | 206 | { |
| 207 | 207 | $address = $name.' <'.$email.'>'; |
| 208 | 208 | } |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | * @param string $email The email address to reply to |
| 216 | 216 | * @param string $name The name to associate with the from address |
| 217 | 217 | */ |
| 218 | - public function setReplyTo($email, $name=false) |
|
| 218 | + public function setReplyTo($email, $name = false) |
|
| 219 | 219 | { |
| 220 | 220 | $address = $email; |
| 221 | - if($name !== false) |
|
| 221 | + if ($name !== false) |
|
| 222 | 222 | { |
| 223 | 223 | $address = $name.' <'.$email.'>'; |
| 224 | 224 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function appendToHTMLBody($body) |
| 264 | 264 | { |
| 265 | - $this->htmlBody.= $body; |
|
| 265 | + $this->htmlBody .= $body; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public function appendToTextBody($body) |
| 274 | 274 | { |
| 275 | - $this->textBody.= $body; |
|
| 275 | + $this->textBody .= $body; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
@@ -295,17 +295,17 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public function addAttachmentFromFile($filename, $name = false) |
| 297 | 297 | { |
| 298 | - if($name === false) |
|
| 298 | + if ($name === false) |
|
| 299 | 299 | { |
| 300 | 300 | $name = basename($filename); |
| 301 | 301 | } |
| 302 | 302 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
| 303 | 303 | $mimeType = finfo_file($finfo, $filename); |
| 304 | - if($mimeType === false) |
|
| 304 | + if ($mimeType === false) |
|
| 305 | 305 | { |
| 306 | 306 | $mimeType = 'application/octet-stream'; |
| 307 | 307 | } |
| 308 | - if(file_exists($filename) && is_file($filename) && is_readable($filename)) |
|
| 308 | + if (file_exists($filename) && is_file($filename) && is_readable($filename)) |
|
| 309 | 309 | { |
| 310 | 310 | $this->addAttachmentFromBuffer($name, file_get_contents($filename), $mimeType); |
| 311 | 311 | } |
@@ -331,18 +331,18 @@ discard block |
||
| 331 | 331 | $boundary = uniqid(rand(), true); |
| 332 | 332 | $rawMessage = 'To: '.$this->encodeRecipients($this->getToAddresses())."\n"; |
| 333 | 333 | $from = $this->getFromAddress(); |
| 334 | - if($from === false) |
|
| 334 | + if ($from === false) |
|
| 335 | 335 | { |
| 336 | 336 | throw new \Exception('Message must have a from address'); |
| 337 | 337 | } |
| 338 | - $rawMessage.= 'From: '.$this->encodeRecipients($from)."\n"; |
|
| 339 | - if(!empty($this->cc)) |
|
| 338 | + $rawMessage .= 'From: '.$this->encodeRecipients($from)."\n"; |
|
| 339 | + if (!empty($this->cc)) |
|
| 340 | 340 | { |
| 341 | - $rawMessage.= 'CC: '. $this->encodeRecipients($this->getCCAddresses())."\n"; |
|
| 341 | + $rawMessage .= 'CC: '.$this->encodeRecipients($this->getCCAddresses())."\n"; |
|
| 342 | 342 | } |
| 343 | - if(!empty($this->bcc)) |
|
| 343 | + if (!empty($this->bcc)) |
|
| 344 | 344 | { |
| 345 | - $rawMessage.= 'BCC: '. $this->encodeRecipients($this->getBCCAddresses())."\n"; |
|
| 345 | + $rawMessage .= 'BCC: '.$this->encodeRecipients($this->getBCCAddresses())."\n"; |
|
| 346 | 346 | } |
| 347 | 347 | $rawMessage .= 'Subject: '.$this->getSubject()."\n"; |
| 348 | 348 | $rawMessage .= 'MIME-Version: 1.0'."\n"; |
@@ -350,27 +350,27 @@ discard block |
||
| 350 | 350 | $rawMessage .= "\n--{$boundary}\n"; |
| 351 | 351 | $rawMessage .= 'Content-type: Multipart/Alternative; boundary="alt-'.$boundary.'"'."\n"; |
| 352 | 352 | $textBody = $this->getTextBody(); |
| 353 | - if($textBody !== false && strlen($textBody) > 0) |
|
| 353 | + if ($textBody !== false && strlen($textBody) > 0) |
|
| 354 | 354 | { |
| 355 | - $rawMessage.= "\n--alt-{$boundary}\n"; |
|
| 356 | - $rawMessage.= "Content-Type: text/plain\n\n"; |
|
| 357 | - $rawMessage.= $textBody."\n"; |
|
| 355 | + $rawMessage .= "\n--alt-{$boundary}\n"; |
|
| 356 | + $rawMessage .= "Content-Type: text/plain\n\n"; |
|
| 357 | + $rawMessage .= $textBody."\n"; |
|
| 358 | 358 | } |
| 359 | - $htmlBody = $this->getHTMLBody(); |
|
| 360 | - if($htmlBody !== false && strlen($htmlBody) > 0) |
|
| 359 | + $htmlBody = $this->getHTMLBody(); |
|
| 360 | + if ($htmlBody !== false && strlen($htmlBody) > 0) |
|
| 361 | 361 | { |
| 362 | 362 | $rawMessage .= "\n--alt-{$boundary}\n"; |
| 363 | 363 | $rawMessage .= 'Content-Type: text/html; charset="UTF-8"'."\n\n"; |
| 364 | 364 | $rawMessage .= $htmlBody."\n"; |
| 365 | 365 | } |
| 366 | - $rawMessage.= "\n--alt-{$boundary}--\n"; |
|
| 367 | - foreach($this->attachments as $attachment) |
|
| 366 | + $rawMessage .= "\n--alt-{$boundary}--\n"; |
|
| 367 | + foreach ($this->attachments as $attachment) |
|
| 368 | 368 | { |
| 369 | - $rawMessage.= "\n--{$boundary}\n"; |
|
| 370 | - $rawMessage.= 'Content-Type: '. $attachment['mimeType'].'; name="'.$attachment['name']."\"\n"; |
|
| 371 | - $rawMessage.= 'Content-Disposition: attachment'."\n"; |
|
| 372 | - $rawMessage.= 'Content-Transfer-Encoding: base64'."\n\n"; |
|
| 373 | - $rawMessage.= chunk_split(base64_encode($attachment['data']), 76, "\n")."\n"; |
|
| 369 | + $rawMessage .= "\n--{$boundary}\n"; |
|
| 370 | + $rawMessage .= 'Content-Type: '.$attachment['mimeType'].'; name="'.$attachment['name']."\"\n"; |
|
| 371 | + $rawMessage .= 'Content-Disposition: attachment'."\n"; |
|
| 372 | + $rawMessage .= 'Content-Transfer-Encoding: base64'."\n\n"; |
|
| 373 | + $rawMessage .= chunk_split(base64_encode($attachment['data']), 76, "\n")."\n"; |
|
| 374 | 374 | } |
| 375 | 375 | $rawMessage .= "\n--{$boundary}--\n"; |
| 376 | 376 | return $rawMessage; |
@@ -385,11 +385,11 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | public function encodeRecipients($recipient) |
| 387 | 387 | { |
| 388 | - if(is_array($recipient)) |
|
| 388 | + if (is_array($recipient)) |
|
| 389 | 389 | { |
| 390 | 390 | return join(', ', array_map(array($this, 'encodeRecipients'), $recipient)); |
| 391 | 391 | } |
| 392 | - if(preg_match("/(.*)<(.*)>/", $recipient, $regs)) |
|
| 392 | + if (preg_match("/(.*)<(.*)>/", $recipient, $regs)) |
|
| 393 | 393 | { |
| 394 | 394 | $recipient = '=?UTF-8?B?'.base64_encode($regs[1]).'?= <'.$regs[2].'>'; |
| 395 | 395 | } |