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
Where can I find the PHP manual?
Viewed 1510 times since Tue, Nov 18, 2008
Are PDO and SQLite supported on the shared hosting?
Viewed 2001 times since Tue, Jul 24, 2012
How does the connection between PHP and MSSQL work?
Viewed 3512 times since Mon, Jul 23, 2012
How do I hide any PHP errors on my website?
Viewed 966 times since Tue, Jul 24, 2012
What is PHP?
Viewed 2189 times since Thu, Nov 27, 2008
Which PHP version is installed on the server? Which modules are available?
Viewed 2731 times since Tue, Nov 18, 2008
Install Joomla 2.5
Viewed 11304 times since Mon, Apr 30, 2012
Is Zend Engine supported?
Viewed 2831 times since Mon, Jul 23, 2012
Is ionCube Encoder/Loader supported?
Viewed 1783 times since Thu, Jul 19, 2012
How do I recognize PHP pages/scripts?
Viewed 2573 times since Tue, Nov 18, 2008