How can a confirmation email be sent simultaneously to the sender when using a PHP email form?
To send a confirmation email simultaneously to the sender when using a PHP email form, you can use the "CC" header in the PHP mail() function to send a copy of the email to the sender's email address. This way, the sender will receive a confirmation email along with the email sent to the recipient.
<?php
$to = "recipient@example.com";
$subject = "Subject of the email";
$message = "This is the message content";
$headers = "From: sender@example.com\r\n";
$headers .= "Reply-To: sender@example.com\r\n";
$headers .= "CC: sender@example.com\r\n";
mail($to, $subject, $message, $headers);
?>
Keywords
Related Questions
- How does implementing SSL encryption impact the security of transmitting passwords in a PHP login form?
- What resources or documentation can be helpful for setting up and managing multiple domain names on a PHP server?
- What are the potential challenges for a Java programmer transitioning to PHP for creating an Intranet?