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
How do I track problems in my PHP website?
Viewed 2298 times since Fri, Jan 21, 2011
Is ionCube Encoder/Loader supported?
Viewed 1920 times since Thu, Jul 19, 2012
Are PDO and SQLite supported on the shared hosting?
Viewed 2237 times since Tue, Jul 24, 2012
What is PHP?
Viewed 2331 times since Thu, Nov 27, 2008
How does the connection between PHP and MSSQL work?
Viewed 4974 times since Mon, Jul 23, 2012
Which PHP version is installed on the server? Which modules are available?
Viewed 2813 times since Tue, Nov 18, 2008
Install Joomla 2.5
Viewed 11419 times since Mon, Apr 30, 2012
How do I hide any PHP errors on my website?
Viewed 1074 times since Tue, Jul 24, 2012
Can I use PHP on IIS 7 (Windows hosting)?
Viewed 1963 times since Tue, Nov 18, 2008
Is Zend Engine supported?
Viewed 2976 times since Mon, Jul 23, 2012