I'm using phpmailer to send email. The code works fine if I'm sending it to just one email address but it won't send to multiple addresses. Is there a configuration that I need to do the mail class or something?
The code is as follows:
$subject="Subject";
$to_name="To Someone";
$to="email1@example.com";
$toCc="email2@example.com";
$message=wordwrap($message,50);
$from_name="TruMoxy";
$from='admin@trumoxy.com';
$mail = new PHPMailer();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.outserver.net";
$mail->SMTPAuth=true;
$mail->Port = 465;
$mail->IsHTML(true);
$mail->Username = "username";
$mail->Password = "password";
$mail->SetFrom($from, 'TruMoxy');
$mail->Subject = $subject;
$mail->Body = "body";
$mail->AddAddress($to,'person1');
$mail->AddCC($toCc,'person2');
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
I've been trying to make this work for almost a week and it seems like something simple but I can't find anything wrong with my limited knowledge of the mailer. Any help with this problem would be very greatly appreciated. Thanks.