Php mail format

The PHP mail format!

In PHP, you can send emails using the mail() function, which takes several parameters to format the email. Here's a breakdown of the format:

mail($to, $subject, $message, $headers)

Here's an example of a basic email format:

<?php
$to = '[email protected]';
$subject = 'Hello from PHP!';
$message = 'This is a test email sent from PHP.';

$headers = 'From: [email protected]'. "\r\n".
           'Reply-To: [email protected]'. "\r\n".
           'Content-Type: text/plain; charset=UTF-8';

mail($to, $subject, $message, $headers);
?>

In this example:

You can also use the headers parameter to specify additional headers, such as:

Here's an example with additional headers:

<?php
$to = '[email protected]';
$subject = 'Hello from PHP!';
$message = 'This is a test email sent from PHP.';

$headers = 'From: [email protected]'. "\r\n".
           'Reply-To: [email protected]'. "\r\n".
           'CC: [email protected]'. "\r\n".
           'BCC: [email protected]'. "\r\n".
           'MIME-Version: 1.0'. "\r\n".
           'Content-Type: text/plain; charset=UTF-8'. "\r\n".
           'Date: Mon, 27 Jul 2020 14:30:00 +0200'. "\r\n".
           'From: John Doe <[email protected]>';

mail($to, $subject, $message, $headers);
?>

Remember to replace the placeholders ($to, $subject, $message, and $headers) with your actual email data.