How to send an email using PHP?

It's possible using PHP's mail() function. Remember the mail function will not work on a local server.
<?php
    $to      = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com'       . "\r\n" .
                 'Reply-To: webmaster@example.com' . "\r\n" .
                 'X-Mailer: PHP/' . phpversion();

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

Reference:



Popular Topics

Recent Languages