How do I send mail from my website using PHP?

You can send emails directly from your PHP website hosted on your shared Linux (Apache) package. Below you can find a sample code to do so. As “From” address you fill in an email address of your own domain name f.i.

$to = ’’;
$subject = ’the subject’;
$message = ’hello’;
$headers = ’From:’ . " " .
’Reply-To:’ . " " .
’X-Mailer: PHP/’ . phpversion();

mail($to, $subject, $message, $headers, ’-f’);

Posted : - Mon, Nov 9, 2009 2:40 PM. This article has been viewed 12445 times.
Online URL:

Powered by PHPKB (Knowledge Base Software)