SHARE
TWEET

Estou com dois problemas no envio de email automatico pelo s

FabioDourado Jan 12th, 2018 (edited) 39 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in C:\xampp\htdocs\loja_doce\classes\Mailer\class.phpmailer.php on line 1853"
  2.  
  3. Linha 1853 do código:
  4.  
  5. switch (strtolower($position)) {
  6. case 'phrase':
  7. $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
  8. break;
  9. case 'comment':
  10. $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
  11. case 'text':
  12. default:
  13.  
  14. E esse outro erro:
  15. "SMTP Error: Could not connect to SMTP host. "
  16. Código abaixo:
  17.  
  18. public function sendEmail($subject, $msg, $from, $nomefrom, $destino, $nomedestino){ require_once "Mailer/class.phpmailer.php"; $mail = new PHPMailer();//Instancia a classe phpMailer
  19.  
  20. $mail->isSMTP(true);//Habilita envio smtp
  21. $mail->SMTPAuth = true;//Autencica o envio smtp
  22. $mail->SMTPSecure = 'ssl';//SSL requerido pelo Gmail
  23. $mail->Host = "smtp.gmail.com";
  24. $mail->Port = '465';//colocar a porta de envio quando o email da doce algodao estiver pronto
  25.  
  26. $mail->Username = 'fabioalvesdourado@gmail.com';
  27. $mail->Password = 'senha';
  28.  
  29. $mail->From = $from;
  30. $mail->FromName = $nomefrom;
  31.  
  32. $mail->isHtml(true);
  33. $mail->Subject = utf8_encode($subject);
  34. $mail->Body =utf8_encode($msg);
  35. $mail->AddAddress($destino, utf8_encode($nomedestino));
  36.  
  37. if($mail->Send()){
  38. return true;
  39. }else{
  40. return false;
  41. }
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top