![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 1 385 Pomógł: 48 Dołączył: 23.05.2007 Ostrzeżenie: (0%) ![]() ![]() |
Mam klase wysyłającą maila
Dodałem funkcje z nagłówkami nag(); Uruchamiam tak:
wszystko działało dobrze tylko jak dodałem te nagłówki to otrzymuje taki błąd Kod Catchable fatal error: Object of class Emailer could not be converted to string in /home/s/public_html/s-s.eu/mail.class.php on line 28 w lini 28 znajduje się
|
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 231 Pomógł: 22 Dołączył: 6.10.2008 Ostrzeżenie: (0%) ![]() ![]() |
Kod <?php class Emailer { private $sender; private $recipients; private $subject; private $body; function __construct($sender) { $this->sender = $sender; $this->recipients = array(); } public function addRecipients($recipient) { array_push($this->recipients, $recipient); } public function setSubject($subject) { $this->subject = $subject; } public function setBody($body) { $this->body = $body; } public function nag($email) { $header = "From: <$email>\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-type: text/html; charset=utf-8\n"; $header .= "Return-Path: <$email>"; return $header; } public function sendEmail() { foreach ($this->recipients as $recipient) { $result = mail($recipient,$this->subject,$this->body,$this->nag()); if($result) { echo '<div id="good">'; echo 'Wiadomość została wysłana'; echo '</div>'; } } } } ?> Takie coś |
|
|
![]() ![]() |
![]() |
Aktualny czas: 26.09.2025 - 01:26 |