Php mail function config

The PHP mail function!

The PHP mail function is used to send emails from a PHP script. Here's a basic configuration guide to get you started:

1. Server Configuration

2. PHP Configuration

Example:

[mail function]
sendmail_path = /usr/sbin/sendmail
SMTP = mail.example.com
smtp_port = 25
mail.add_x_header = On
mail.log = /var/log/phpmail.log

3. PHP Mail Function

Example:

<?php
$to = '[email protected]';
$subject = 'Test Email';
$message = 'This is a test email sent from PHP.';
$headers = array(
    'From' => '[email protected]',
    'To' => $to,
    'Subject' => $subject
);

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

4. Additional Tips

By following these steps, you should be able to configure the PHP mail function to send emails from your PHP script.