0

I'm looking to make a contact form send to more than 1 address. currently the code is

$to = 'email@email.com'; 

Further down the code is

function xmail($to,$subject,$message,$headers){
    global $usesmtp,$smtphost,$smtpport,$smtpuser,$smtppass,$smtpsecure,$_POST;
    if($usesmtp!=1){
        if(@mail($to,$subject,$message,$headers)){
            return 1;
        }
    }else{
        require_once('mail/class.phpmailer.php');
        $mail             = new PHPMailer();
        $body             =$message;
        $mail->IsSMTP();
        $mail->SMTPDebug  = 0; 
        $mail->SMTPAuth   = true;   
        $mail->SMTPSecure = $smtpsecure;       
        $mail->Host       = $smtphost;     
        $mail->Port       = $smtpport;                
        $mail->Username   = $smtpuser;  
        $mail->Password   = $smtppass;          
        $mail->SetFrom($_POST['email'], $_POST['name']);
        $mail->Subject    = $subject;
        $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; 
        $mail->MsgHTML($body);
        $address        = $to;
        $mail->AddAddress($address, "Administrator");
        if($mail->Send()) {
          return 1;
        }
    }
}

Can anyone help please?

Matt
  • 22,721
  • 17
  • 71
  • 112
user1019002
  • 41
  • 1
  • 7

1 Answers1

0

Changed

$to = 'email@email.com'; 

To

$to = 'email@email.com, email2@email2.com';
user1019002
  • 41
  • 1
  • 7