Article ID: 3333, created on Nov 30, 2007, last review on May 11, 2014

  • Applies to:
  • H-Sphere

Resolution

There are two way to test mail on web server:
1) via sendmail from command line
You need to put this command on command line on your web server:
# echo -e "To:username@example.com \nSubject: Test mail from web\n\n Test mail from web via senmail\n" | sendmail -t -F root@web.domain.com

2) via php script from browser
Create the test php script on your web server in /hsphere/shared/apache/htdocs dir.
# vi /hsphere/shared/apache/htdocs/testmailfromweb.php
;======testmailfromweb.php=====
<?php
$to = "username@example.com";
$subject = "Test mail from web";
$body = "Hi,\n\nTest mail from web via php script";
if (mail($to, $subject, $body)) {
echo(" <p>Message successfully sent! </p>");
} else {
echo(" <p>Message delivery failed... </p>");
}
?>
;=======================
The first argument to this function is the recipient, the second specifies the message's subject and the third one should contain the body. In your bowser put the following: http:///testmailfromweb.php

f213b9fa8759d57bee5d547445806fe7 6311ae17c1ee52b36e68aaf4ad066387

Email subscription for changes to this article
Save as PDF