Please use [php] tags when posting PHP code in this forum. It helps to keep long lines wrapped so we don't have to scroll horizontally to read your code 😉
To add a "Carbon-Copy" recipient, you need to add the header field "Cc". So the last parameter in the mail() function is this:
"From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\n"
You need to add the Cc field:
Cc: $email\r\n
So that line looks like this:
"From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n"
As for sending an HTML message... I'm not the best to answer this (as I don't send HTML mail). I will say this though, typically HTML mail sent from using PHPs mail() function has a higher tendency to be flagged as spam. So plain-text is the better way to go.
But if you wanted to add HTML to it, the PHP Manual[/man] has a good example of sending HTML mail. It's example #4. Notice that the line we edited above is now split into parts, each one concatenating onto the previous. So our current line would look like:
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
$headers .= "Return-Path: $email\r\n";
$headers .= "Cc: $email\r\n";
Then, you'd need to set the MIME-Version and Content-type headers, and then just change the message to HTML.
If you're going to do that, I'd suggest sending a plain-text part along with the HTML for those users that can't read HTML mail. It also looks less like spam. I use a class called Swiftmailer to send HTML and Plain-text mail to recipients. I use it for 2 reasons:
1.) It can send both HTML and Plain-text mail at the same time
2.) It can use a real SMTP server with whatever user I choose
You can send the HTML and Plain-text parts on your own using the mail() function; however, you'll have to google on how to do it. I'm not 100% sure, and since there are already softwares out there that do this over and over again, I just used one.