How can the sender be controlled when using Windows sendmail in PHP?
When using Windows sendmail in PHP, the sender can be controlled by setting the additional parameters in the mail() function. You can specify the sender email address and name using the "-f" parameter to set the 'From' header.
$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: Sender Name <sender@example.com>";
$additional_headers = "-f sender@example.com";
mail($to, $subject, $message, $headers, $additional_headers);
Keywords
Related Questions
- How can the encoding of ODBC be influenced in PHP to ensure proper handling of special characters?
- What are some potential pitfalls of using JavaScript to make calls to a local server for PDF generation in PHP?
- What are the advantages and disadvantages of using $_GET versus $_POST for passing data in PHP scripts?