Advertisement
xandr91

Q2APHP PRO 2.0.0 smtp fix

Jan 26th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1.     /* Open core/engine.php and replace function end_email by this one: */
  2.  
  3.     public function send_email($to_user, $subject, $message) {
  4.  
  5.         if(SITE_EMAIL_NOTIFICATIONS==1) {
  6.             if(filter_var($to_user, FILTER_VALIDATE_EMAIL)) {
  7.                 $to = $to_user;
  8.             }
  9.             else {
  10.                 $to = engine::getuserdata($to_user,"EMAIL");
  11.             }
  12.             if(SMTP_USER!='' && SMTP_PASS!='') {
  13.                 $mail = new PHPMailer();
  14.                 $mail->IsSMTP();
  15.                 $mail->SMTPDebug = 1;
  16.                 $mail->SMTPAuth = true;
  17.                 $mail->SMTPSecure = 'ssl';
  18.                 $mail->Host = SITE_SMTP_HOST;
  19.                 $mail->Port = SITE_SMTP_PORT;
  20.                 $mail->IsHTML(true);
  21.                 $mail->Username = SITE_SMTP_USER;
  22.                 $mail->Password = SITE_SMTP_PASS;
  23.                 $mail->SetFrom(SITE_SMTP_USER, SITE_NAME);
  24.                 $mail->AddReplyTo(SITE_SMTP_USER, "No-Reply");
  25.                 $mail->Subject = $subject;
  26.                 $mail->Body = $message;
  27.                 $mail->AddAddress($to);
  28.                 $mail->Send();
  29.             }
  30.             else {
  31.                 $headers = 'From: '.SITE_NAME.' no-reply@'.SITE_DOMAIN.'' . "\r\n" ;
  32.                 $headers .='Reply-To: '. $to . "\r\n" ;
  33.                 $headers .='X-Mailer: PHP/' . phpversion();
  34.                 $headers .= "MIME-Version: 1.0\r\n";
  35.                 $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  36.                 mail($to, $subject, $message, $headers);
  37.             }
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement