07-09-2006, 02:16 PM
I had a buddy of mine ask if there was a quick easy way to send email with a PHP script. He is just learning PHP so I was happy to help him. After I sent him the code he was so impressed it was so easy I figured I'd post the code here for anyone else that needs it.
<?php
$to = "the email address to send the email to";
$subject = "Your subject";
$body = "The information you want to send";
//Send the email
if (mail($to, $subject, $body)) {
echo("Email sent successfully");
}
else {
echo("Email NOT sent successfully");
}
?>
<?php
$to = "the email address to send the email to";
$subject = "Your subject";
$body = "The information you want to send";
//Send the email
if (mail($to, $subject, $body)) {
echo("Email sent successfully");
}
else {
echo("Email NOT sent successfully");
}
?>