PHP邮件不要在“收件人”标题中显示“收件人”

I want to make an email forwarder similar to cPanel's, where I have a database of email addresses, and where they should forward to, and I set a catch-all to pipe to my script.

I have completed this script, however, I would like to make the "To:" field in the header show the address it was sent to, rather than who is was being delivered to. For example, the email was sent to user001@mydomain.com, and the script forwards it to me@gmail.com. How can I make PHP send mail to me@gmail.com, but still show user001@mydomain.com in the headers, like cPanel does?

You can use the headers of the mail function:

$to = 'me@gmail.com';
$subject = 'Testing';
$message = 'This is a test';
$headers .= 'To: User001 <user001@mydomain.com>, User002 <user002@mydomain.com>' . "
";
$headers .= 'From: My Email Script <me@gmail.com>' . "
";
mail($to, $subject, $message, $headers);