I'd like to send one email to the registered user and a seperate email to the Administrator, with a separate body.
I thought I could just duplicate the mail() but now neither email is being sent.

Email 1 - Activation Email to the Registered User

$to      = "liz.banbury@gmail.com, ".$reg_email;
            $subject = 'Bright-Tutors - Registration Confirmation';
            $msg =  "Welcome to our website!\r\rYou, or someone using your email address, has completed registration at bright-tutors.com. \n" . 
            "You can complete registration by clicking the following  link:\rhttp://www.bright-tutors.com/verify.php?$activationKey\r\r \n" .
            "If this is an error, ignore this email and you will be removed from our mailing list. \n" .
            "Regards,\n Bright-Tutors.com Team \n" . 
            "------------------------------------------------------------\n" .
            "Please take note of your registered username and password and keep them safely.\n" .
            "------------------------------------------------------------\n" .
            "Registered Username: $username\n" .
            "Registered Password: $password1";

            $headers = 'From: admin@xxxxxxxx.com,$reg_email' . "\r\n" .
            'Reply-To: $reg_email' . "\r\n" .
            'X-Mailer: PHP/' . phpversion();
            mail($to, $subject, $msg, $headers);

Email 2 - To the Administrator:

$to2      = "liz.banbury@gmail.com, admin@xxxxxxx.com";
            $subject2 = 'Bright-Tutors - Registration Confirmation';
            $msg2 =  "$reg_name has completed registration at bright-tutors.com. \n" . 
            "Please contact them at: " .$reg_email;

            $headers = 'From: admin@xxxxxxx.com,$reg_email' . "\r\n" .
            'Reply-To: $reg_email' . "\r\n" .
            'X-Mailer: PHP/' . phpversion();
            mail($to2, $subject2, $msg2, $headers);

Any help would be great thanks.

3 Years
Discussion Span
Last Post by ebanbury

Hi, try to remove the white spaces between the addresses in the destination variables $to and $to2, so these:

$to      = "email@gmail.com, ".$reg_email;
$to2     = "email@gmail.com, admin@xxxxxxx.com";

Should be:

$to      = "email@gmail.com,".$reg_email;
$to2     = "email@gmail.com,admin@xxxxxxx.com";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.