Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: PHPMailer i czas generowania strony
Forum PHP.pl > Forum > Gotowe rozwiązania
deniol13
witam, mam phpmailera, moj skrypt forum w 30% gotowy, zrobilem aby rejestracja wymagala aktywacje konta poprzez email, juz wszystko smiga, email dostaje, kod aktywacji sie generuje ale... jak mialem czas generowania strony 0.01s to teraz mam prawie 3s, czy to normalne ? moze dlatego ze na localu to robie?
zrobilem sobie dodatkowa klase Mail za pomoca ktorej odwoluje sie do klasy phpmailer'a


  1. <?php
  2. /*========================================================================*\
  3.  * Fusion Bulletin Board
  4.  *
  5.  * @package : Fusion Bulletin Board
  6.  * @author : xxx
  7.  * @license : <a href="http://www.gnu.org/licenses/gpl-3.0.html" target="_blank">http://www.gnu.org/licenses/gpl-3.0.html</a>
  8.  *
  9.  *========================================================================*|
  10.  *
  11.  * $Date$
  12.  * $Revision$
  13.  * $Author$
  14.  *
  15.  *========================================================================*/
  16.  
  17.  
  18. class Mail
  19. {
  20. private $object = NULL;
  21.  
  22. public function create()
  23. {
  24. require_once( CLASSES . 'phpmailer.Class.php' ); //Includujemy klase phpmailer
  25.  
  26. $this->object = new PHPMailer();
  27. }
  28.  
  29. public function send_mail( $receiver, $subject, $message )
  30. {
  31. global $board, $smtp;
  32.  
  33. $mail = $this->object;
  34.  
  35. $mail->IsSMTP();
  36. $mail->Host = $smtp['host']; // SMTP server
  37. $mail->SMTPAuth = true; // enable SMTP authentication
  38. $mail->SMTPSecure = $smtp['prefix']; // sets the prefix to the servier
  39. $mail->Host = $smtp['host']; // sets GMAIL as the SMTP server
  40. $mail->Port = $smtp['port']; // set the SMTP port for the GMAIL server
  41. $mail->Username = $smtp['username'];
  42. $mail->Password = $smtp['password'];
  43.  
  44. $mail->SetFrom( $smtp['username'] , $board['board_name']);
  45.  
  46. $mail->Subject = $subject . ' - ' . $board['board_name'];
  47.  
  48. $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
  49.  
  50. $mail->MsgHTML( $message );
  51.  
  52. $mail->AddAddress( $receiver, '' );
  53.  
  54. if( !$mail->Send() )
  55. {
  56. return false;
  57. }
  58. else
  59. {
  60. return true;
  61. }
  62. }
  63. }
  64.  
  65. ?>


czy mozliwe ze to phpmailer tak zwalnia? albo ja zle korzystam z niego
luki100011
prawdopodobnie, bo przecież musi połączyć się z zewnętrznym serwerem (wysyłasz przez SMTP) i wysłać e-mail, postaw to na zewnętrznym hosting i zobacz wtedy jaki będzie czas.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2024 Invision Power Services, Inc.