| 310 | | if ($this->getRecipientName() != "") { |
| 311 | | $headers = "To: \"" . $this->getRecipientName() . "\" <" . $this->getRecipientEmail() . ">\r\n"; |
| 312 | | } |
| 313 | | |
| 314 | | $headers = "From: \"" . $this->getSenderName() . "\" <" . $this->getSenderEmail() . ">\r\n"; |
| 315 | | $headers .= "Reply-To: " . $this->getSenderEmail() . "\r\n"; |
| 316 | | $headers .= "Content-Type: text/plain; charset=utf-8"; |
| 317 | | |
| 318 | | if (defined("WIFIDOG_NAME")) { |
| 319 | | $headers .= "\r\n" . "X-Mailer: " . WIFIDOG_NAME . defined("WIFIDOG_VERSION") ? "/" . WIFIDOG_VERSION : ""; |
| 320 | | } |
| 321 | | |
| 322 | | $args = "-f" . $this->getSenderEmail(); |
| 323 | | |
| 324 | | return mail($this->getRecipientEmail(), $this->getMessageSubject(), $this->getMessageBody(), $headers, $args); |
| | 314 | $mail = new PHPMailer(); |
| | 315 | $mail->CharSet = "utf-8"; |
| | 316 | |
| | 317 | $mail->Mailer = EMAIL_MAILER; |
| | 318 | if (EMAIL_MAILER == 'smtp') { |
| | 319 | $mail->Host = EMAIL_HOST; |
| | 320 | $mail->SMTPAuth = EMAIL_AUTH; |
| | 321 | |
| | 322 | if (EMAIL_AUTH) { |
| | 323 | $mail->Username = EMAIL_USERNAME; |
| | 324 | $mail->Password = EMAIL_PASSWORD; |
| | 325 | } |
| | 326 | } |
| | 327 | |
| | 328 | $mail->AddAddress($this->getRecipientEmail(), $this->getRecipientName()); |
| | 329 | $mail->From = $this->getSenderEmail(); |
| | 330 | $mail->FromName = $this->getSenderName(); |
| | 331 | $mail->Sender = $this->getSenderEmail(); // add Sender Name |
| | 332 | $mail->Subject = $this->getMessageSubject(); |
| | 333 | $mail->Body = $this->getMessageBody(); |
| | 334 | |
| | 335 | $result = $mail->Send(); |
| | 336 | if (!$result) { |
| | 337 | print $mail->ErrorInfo; |
| | 338 | } |
| | 339 | return $result; |