Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z funkcja mail()
tomek_i_ola
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 14.10.2008

Ostrzeżenie: (0%)
-----


witam,
mam problem z kodem, gdyz wyskakuje mi taki błąd
Cytat
Warning: mail() expects at least 3 parameters, 1 given in /home/epaturi/domains/prowsiiz.pdg.pl/public_html/class.SimpleMail.php on line 70

Fatal error: Uncaught exception 'Exception' with message 'Wysyłanie listu zakończone niepowodzeniem.' in /home/epaturi/domains/prowsiiz.pdg.pl/public_html/class.SimpleMail.php:71 Stack trace: #0 /home/epaturi/domains/prowsiiz.pdg.pl/public_html/user_transact.php(75): SimpleMail->send('tomek@w...') #1 {main} thrown in /home/epaturi/domains/prowsiiz.pdg.pl/public_html/class.SimpleMail.php on line 71


a to jest kod z class.SimpleMail.php
  1. <?php
  2.  
  3. class SimpleMail {
  4. public $to = NULL;
  5. public $cc = NULL;
  6. public $bcc = NULL;
  7. public $from = NULL;
  8. public $subject = '';
  9. public $body = '';
  10. public $htmlbody = '';
  11. public $send_text = TRUE;
  12. public $send_html = FALSE;
  13. private $message = '';
  14. private $headers = '';
  15.  
  16. public function send($to = NULL,
  17.                        $subject = NULL,
  18.                        $message = NULL,
  19.                        $headers = NULL) {
  20. if (func_num_args() >= 3) {
  21. $this->to = $to;
  22. $this->subject = $subject;
  23. $this->message = $message;
  24. if ($headers) {
  25.    $this->headers = $headers;
  26. }
  27.  
  28. } else {
  29.  
  30. if ($this->from) {
  31. $this->headers .= "From: " . $this->from . "r\n";
  32. }
  33. if ($this->cc) {
  34. $this->headers .= "Cc: " . $this->cc . "r\n";
  35. }
  36. if ($this->bcc) {
  37. $this->headers .= "Bcc: " . $this->bcc . "r\n";
  38. }
  39.  
  40. if ($this->send_text and !$this->send_html) {
  41. $this->message = $this->body;
  42. } elseif ($this->send_html and !$this->send_text) {
  43. $this->message = $this->htmlbody;
  44. $this->headers .= "MIME-Version: 1.0r\n";
  45. $this->headers .= "Content-type: text/html; " .
  46. "charset=iso-8859-2r\n";
  47. } else {
  48. $_boundary = "==MP_Bound_xyccr948x==";
  49.  
  50. $this->headers = "MIME-Version: 1.0r\n";
  51. $this->headers .= "Content -type: multipart/alternative; " .
  52.         "boundary=\"$_boundary\"r\n";
  53.  
  54. $this->message = "Jest to wiadomość wielocześciowa w " .
  55.         "formacie MIME\n";
  56. $this->message .= "--$_boundary\n";
  57. $this->message .= "Content-Type: text/plain: " .
  58.          "charset=\"iso-8859-2\"\n";
  59. $this->message .= "Content-Transfer-Encoding: 8bit\n\n";
  60. $this->message .= $this->body . "\n";
  61. $this->nessage .= "--$_boundary\n";
  62. $this->message .= "Content-type: text/html: " .
  63.          "charset=\"iso-8859-2\"\n";
  64. $this->message .= "Content-Transfer-Encoding: 8bit\n\n";
  65. $this->message .= $this->htmlbody . "\n";
  66. $this->message .= "--$_boundary--";
  67. }
  68. }
  69.  
  70. if (!mail($this->to.$this->subject.$this->message.$this->headers)) {
  71. throw new Exception('Wysyłanie listu zakończone niepowodzeniem.');
  72. return FALSE;
  73. } else {
  74. return TRUE;
  75.  }
  76. }
  77. }
  78.  
  79. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.09.2025 - 15:17