@@ -227,11 +227,13 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function send() |
| 229 | 229 | { |
| 230 | - if($this->passed_validation === FALSE) |
|
| 231 | - return false; |
|
| 230 | + if($this->passed_validation === FALSE) { |
|
| 231 | + return false; |
|
| 232 | + } |
|
| 232 | 233 | |
| 233 | - if(!$this->check_required_fields()) |
|
| 234 | - return false; |
|
| 234 | + if(!$this->check_required_fields()) { |
|
| 235 | + return false; |
|
| 236 | + } |
|
| 235 | 237 | |
| 236 | 238 | $to = $this->get_to(); |
| 237 | 239 | $subject = $this->subject; |
@@ -286,8 +288,9 @@ discard block |
||
| 286 | 288 | { |
| 287 | 289 | $message = ''; |
| 288 | 290 | |
| 289 | - if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
| 290 | - $message .= "--{$this->get_boundary()}" . self::$LINE_BREAK; |
|
| 291 | + if(isset($this->attachment_array) && count($this->attachment_array) > 0) { |
|
| 292 | + $message .= "--{$this->get_boundary()}" . self::$LINE_BREAK; |
|
| 293 | + } |
|
| 291 | 294 | |
| 292 | 295 | if( |
| 293 | 296 | isset($this->plain_message) && strlen($this->plain_message) > 0 && |
@@ -312,8 +315,7 @@ discard block |
||
| 312 | 315 | $message .= self::$LINE_BREAK; |
| 313 | 316 | $message .= "--{$this->get_alternative_boundary()}--" . self::$LINE_BREAK; |
| 314 | 317 | $message .= self::$LINE_BREAK; |
| 315 | - } |
|
| 316 | - else if(isset($this->plain_message) && strlen($this->plain_message)) |
|
| 318 | + } else if(isset($this->plain_message) && strlen($this->plain_message)) |
|
| 317 | 319 | { |
| 318 | 320 | if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
| 319 | 321 | { |
@@ -323,8 +325,7 @@ discard block |
||
| 323 | 325 | } |
| 324 | 326 | $message .= $this->plain_message; |
| 325 | 327 | $message .= self::$LINE_BREAK; |
| 326 | - } |
|
| 327 | - else if(isset($this->html_message) && strlen($this->html_message)) |
|
| 328 | + } else if(isset($this->html_message) && strlen($this->html_message)) |
|
| 328 | 329 | { |
| 329 | 330 | if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
| 330 | 331 | { |
@@ -361,8 +362,9 @@ discard block |
||
| 361 | 362 | private $boundary; |
| 362 | 363 | private function get_boundary() |
| 363 | 364 | { |
| 364 | - if(!isset($this->boundary)) |
|
| 365 | - $this->boundary = sprintf(self::$BOUNDARY_FORMAT, md5(date('r', time()) . self::$BOUNDARY_SALT)); |
|
| 365 | + if(!isset($this->boundary)) { |
|
| 366 | + $this->boundary = sprintf(self::$BOUNDARY_FORMAT, md5(date('r', time()) . self::$BOUNDARY_SALT)); |
|
| 367 | + } |
|
| 366 | 368 | return $this->boundary; |
| 367 | 369 | } |
| 368 | 370 | |
@@ -375,8 +377,9 @@ discard block |
||
| 375 | 377 | private $alternative_boundary; |
| 376 | 378 | private function get_alternative_boundary() |
| 377 | 379 | { |
| 378 | - if(!isset($this->alternative_boundary)) |
|
| 379 | - $this->alternative_boundary = sprintf(self::$ALTERNATIVE_BOUNDARY_FORMAT, md5(date('r', time()) . self::$ALTERNATIVE_BOUNDARY_SALT)); |
|
| 380 | + if(!isset($this->alternative_boundary)) { |
|
| 381 | + $this->alternative_boundary = sprintf(self::$ALTERNATIVE_BOUNDARY_FORMAT, md5(date('r', time()) . self::$ALTERNATIVE_BOUNDARY_SALT)); |
|
| 382 | + } |
|
| 380 | 383 | return $this->alternative_boundary; |
| 381 | 384 | } |
| 382 | 385 | |
@@ -393,21 +396,23 @@ discard block |
||
| 393 | 396 | $headers .= "{$key}: {$value}" . self::$LINE_BREAK; |
| 394 | 397 | } |
| 395 | 398 | |
| 396 | - if(count($this->cc_array) > 0) |
|
| 397 | - $headers .= 'CC: ' . implode(', ', $this->cc_array) . self::$LINE_BREAK; |
|
| 398 | - if(count($this->bcc_array) > 0) |
|
| 399 | - $headers .= 'BCC: ' . implode(', ', $this->bcc_array) . self::$LINE_BREAK; |
|
| 399 | + if(count($this->cc_array) > 0) { |
|
| 400 | + $headers .= 'CC: ' . implode(', ', $this->cc_array) . self::$LINE_BREAK; |
|
| 401 | + } |
|
| 402 | + if(count($this->bcc_array) > 0) { |
|
| 403 | + $headers .= 'BCC: ' . implode(', ', $this->bcc_array) . self::$LINE_BREAK; |
|
| 404 | + } |
|
| 400 | 405 | |
| 401 | - if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
| 402 | - $headers .= "Content-Type: multipart/mixed; boundary=\"{$this->get_boundary()}\""; |
|
| 403 | - else if( |
|
| 406 | + if(isset($this->attachment_array) && count($this->attachment_array) > 0) { |
|
| 407 | + $headers .= "Content-Type: multipart/mixed; boundary=\"{$this->get_boundary()}\""; |
|
| 408 | + } else if( |
|
| 404 | 409 | isset($this->plain_message) && strlen($this->plain_message) > 0 && |
| 405 | 410 | isset($this->html_message) && strlen($this->html_message) > 0) |
| 406 | 411 | { |
| 407 | 412 | $headers .= "Content-Type: multipart/alternative; boundary=\"{$this->get_alternative_boundary()}\""; |
| 413 | + } else if(isset($this->html_message) && strlen($this->html_message) > 0) { |
|
| 414 | + $headers .= 'Content-type: text/html; charset="iso-8859-1"'; |
|
| 408 | 415 | } |
| 409 | - else if(isset($this->html_message) && strlen($this->html_message) > 0) |
|
| 410 | - $headers .= 'Content-type: text/html; charset="iso-8859-1"'; |
|
| 411 | 416 | |
| 412 | 417 | return $headers; |
| 413 | 418 | } |