How to create a Test Mail Script?



Login to SSH with root user

cd /home//public_html

Create test phpmail fine

pico phpmail.php

Insert following code in that file

$to = “recipient@example.com”;
$subject = “Hi!”;
$body = “Hi,\n\nHow are you?”;
if (mail($to, $subject, $body)) {
echo(“

Message successfully sent!

“);
} else {
echo(“

Message delivery failed…

“);
}
?>

Then cange the ownership of that file :

chown user.user phpmail.php

Then test the script in browser or in SSH, you will get follwing result, which means php mail function working fine

————————————-
-bash-2.05b# php phpmail.php

X-Powered-By: PHP/4.4.2
Content-type: text/html

Message successfully sent!


Responses

0 Respones to "How to create a Test Mail Script?"

Post a Comment

 

Recent Comments

Popular Posts

Return to top of page Copyright © 2010 | Platinum Theme Converted into Blogger Template by HackTutors