<?php function user_mail($maila, $subject, $message, $header) { require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->Host = "mail.serwer.pl"; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "serwer"; // SMTP username $mail->Password = "haslo"; // SMTP password $mail->From = "serwer@serwer.pl"; $mail->FromName = "serwer"; $mail->AddAddress($maila); $mail->IsHTML(true); // send as HTML $mail->Subject = $subject; $mail->Body = $message; $mail->AltBody = $message; if($mail->Send()){ return true; } } ?>
teraz chciałbym wysłać ten sam mail do dwóch osób, próbuję zrobić to tak:
<?php $maila = $user->mail; user_mail($maila, $subject, $message, $header); $maila = $mail_handlowca; user_mail($maila, $subject, $message, $header); ?>
i pojawia się błąd:
Kod
Fatal error: Cannot redeclare class phpmailer in class.phpmailer.php on line 21
jak zrobić żeby poprzez wywołanie user mail() wysłać te maile? (chcę aby to były dwie oddzielne wiadomości)