Wednesday, 9 September 2009

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 = "only24x7support@gmail.com";

$subject = "Hi!";

$body = "Hi,nnHow 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

Login to SSH with root user


# cd /home//public_html


Create test phpmail fine


#  pico phpmail.php


Insert following code in that file


<?

$to = "only24x7support@gmail.com";

$subject = "Hi!";

$body = "Hi,nnHow 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!


#@$* Ya you did it .....


~^*!#@ ??_?????^?????_?????~??V?_????? – ?Ú????? @#!*^~


??g?_g????^?????_g????~????_g???? – ?????????




No comments:

Post a Comment