What are some common headers used in PHP email sending functions?
When sending emails in PHP, it is important to include headers for various purposes such as setting the content type, specifying the sender, and adding additional information. Some common headers used in PHP email sending functions include "From", "Reply-To", "Content-Type", and "Cc" (carbon copy).
// Example of sending an email with common headers using PHP
$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: sender@example.com\r\n";
$headers .= "Reply-To: replyto@example.com\r\n";
$headers .= "Cc: cc@example.com\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers);
Keywords
Related Questions
- How can the use of JavaScript for setting focus in the PHP script be replaced with more efficient and modern techniques for better functionality?
- How can PHP and MySQL be effectively combined to achieve the desired date sorting and formatting results in queries?
- What potential issues can arise when using Krusader as an FTP program for editing PHP documents?