Headers php mail server

Here are some common headers that can be used in a PHP mail script to configure the mail server and improve deliverability:

From Header

To Header

Subject Header

Reply-To Header

CC Header

BCC Header

MIME Header

Authentication Header

Other Headers

Here is an example of a PHP mail script that uses some of these headers:

<?php
$headers = array(
    'From' => 'John Doe <[email protected]>',
    'To' => '[email protected]',
    'Subject' => 'Test Email',
    'Reply-To' => '[email protected]',
    'MIME-Version' => '1.0',
    'Content-Type' => 'text/plain; charset=UTF-8',
    'Authentication-Results' => 'spf=pass (sender IP is 192.0.2.1) smtp.mailfrom=example.com',
    'DKIM-Signature' => 'v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=example; h=From:To:Subject:Date:Message-ID; bh=...; b=...',
    'Date' => date('r'),
    'Message-ID' => '<'. uniqid(). '@example.com>',
    'X-Mailer' => 'PHPMailer 6.0.5 (https://github.com/PHPMailer/PHPMailer)',
    'X-Priority' => '3'
);

$mail = mail('[email protected]', 'Test Email', 'This is a test email.', $headers);

if ($mail) {
    echo 'Email sent successfully!';
} else {
    echo 'Error sending email!';
}
?>

Note that the specific headers and values used may vary depending on your email server and the requirements of your email recipients.