Simple PHP Mail Script
<?php
$to = '[email protected]';
$subject = 'PHP mail test';
$message = 'This is body of email';
$from = "From: FirstName LastName <[email protected]>";
mail($to,$subject,$message,$from);
?>
This is a simple PHP mail script. Usually I use it for testing purposes.
Copy and paste this into a test-mail.php file:
<?php
$to = '[email protected]';
$subject = 'PHP mail test';
$message = 'This is body of email';
$from = "From: FirstName LastName <[email protected]>";
mail($to,$subject,$message,$from);
?>
Then to run the script just run:
php test-mail.php
This is very useful for testing this on a Linux machine, so if you need to send a few emails you can do something like this:
for i in {1..3}; do php test-mail.php; done
This would run the test PHP script 3 times.
No explanation generated yet.