How can PHP be used to send emails with a specific sender address?
To send emails with a specific sender address using PHP, you can use the `mail()` function with additional headers specifying the sender address. You need to set the "From" header in the additional headers parameter of the `mail()` function.
$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: sender@example.com\r\n";
mail($to, $subject, $message, $headers);
Keywords
Related Questions
- What are the potential security risks associated with hidden input fields in PHP forms?
- What is the difference between using mysql_fetch_assoc() and mysql_fetch_array() in PHP when dealing with arrays?
- What is the significance of the error message "Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR)" in PHP?