Ver código fonte

Use mail() function when SMTP functions do not exist

Alan Lam 7 anos atrás
pai
commit
e67974fc13
1 arquivos alterados com 14 adições e 7 exclusões
  1. 14 7
      engine/email.php

+ 14 - 7
engine/email.php

@@ -12,13 +12,20 @@ class Email {
 	// Static functions
 	// Static functions
 	public static function getPHPMailerInstance() {
 	public static function getPHPMailerInstance() {
 		$mail = new PHPMailer(true);
 		$mail = new PHPMailer(true);
-		$mail->isSMTP();
-		$mail->Host = SMTP_HOST;
-		$mail->SMTPAuth = true;
-		$mail->Username = SMTP_USERNAME;
-		$mail->Password = SMTP_PASSWORD;
-		$mail->SMTPSecure = SMTP_AUTHENTICATION_TYPE;
-		$mail->Port = SMTP_PORT;
+
+		if(defined("SMTP_HOST")) {
+			$mail->isSMTP();
+			$mail->Host = SMTP_HOST;
+			$mail->SMTPAuth = true;
+			$mail->Username = SMTP_USERNAME;
+			$mail->Password = SMTP_PASSWORD;
+			$mail->SMTPSecure = SMTP_AUTHENTICATION_TYPE;
+			$mail->Port = SMTP_PORT;
+        }
+		else {
+		    $mail->isMail();
+        }
+
 		$mail->CharSet = 'UTF-8';
 		$mail->CharSet = 'UTF-8';
 		$mail->Encoding = 'base64';
 		$mail->Encoding = 'base64';
 		return $mail;
 		return $mail;