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 2225 times since Thu, Nov 27, 2008
How do I hide any PHP errors on my website?
Viewed 1011 times since Tue, Jul 24, 2012
Are PDO and SQLite supported on the shared hosting?
Viewed 2051 times since Tue, Jul 24, 2012
Is Zend Guard/Optimizer supported?
Viewed 1234 times since Mon, Jul 23, 2012
Is Zend Engine supported?
Viewed 2885 times since Mon, Jul 23, 2012
Where can I find the PHP manual?
Viewed 1545 times since Tue, Nov 18, 2008
Can I use PHP on IIS 7 (Windows hosting)?
Viewed 1787 times since Tue, Nov 18, 2008
Which PHP version is installed on the server? Which modules are available?
Viewed 2758 times since Tue, Nov 18, 2008
Install Joomla 2.5
Viewed 11341 times since Mon, Apr 30, 2012
How does the connection between PHP and MSSQL work?
Viewed 4366 times since Mon, Jul 23, 2012