PHP – Send Emails – mail()

You can send emails directly from PHP scripts using the mail() function.  You need to have a local email server setup to do this, to to learn it’s best to use a shared hosting account which will have one already.

<?php

$to = "name@emailaddress.com";

$subject = "this is a test";

$message = "test from PHP script";

$headers = "From:Test@Test.com";

$time = time();

mail($to, $subject, $message, $headers);

print "Script Ran $time";

?>

Be the first to comment

Leave a Reply