Telenet Cloud Online Help

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. webmaster@your-domain.be.

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

mail($to, $subject, $message, $headers, ’-f webmaster@example.com’);
?>

3.67 (3)
Article Rating (3 Votes)
Rate this article
Attachments
There are no attachments for this article.
Related Articles
What is PHP?
Viewed 3553 times since Thu, Nov 27, 2008
Is Zend Guard/Optimizer supported?
Viewed 1394 times since Mon, Jul 23, 2012
Is ionCube Encoder/Loader supported?
Viewed 2020 times since Thu, Jul 19, 2012
Is Zend Engine supported?
Viewed 3054 times since Mon, Jul 23, 2012
How does the connection between PHP and MSSQL work?
Viewed 6944 times since Mon, Jul 23, 2012
Can I use PHP on IIS 7 (Windows hosting)?
Viewed 2030 times since Tue, Nov 18, 2008
How do I recognize PHP pages/scripts?
Viewed 4972 times since Tue, Nov 18, 2008
Where can I find the PHP manual?
Viewed 1696 times since Tue, Nov 18, 2008
How do I track problems in my PHP website?
Viewed 2398 times since Fri, Jan 21, 2011
Are PDO and SQLite supported on the shared hosting?
Viewed 2408 times since Tue, Jul 24, 2012