Testing of the mail function of PHP from shell on the server.

1. Download little script – http://it.sysnet.by/scripts/mail-test.script
 

<?php
$to = "info@sysnet.by";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "test@sysnet.by";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
printf("Mail Sent.\n");
?>

 
2. Open file and change variables $to and/or $from
3. Execute in shell:
 

sysnetb@sysnet.by [~/]# php mail-test.php
Mail Sent.
sysnetb@sysnet.by [~/]#

 
4. If you have correctly installed mail daemon, then you should get message.
If the mail message,that was sent from the form of site (PHP) still don’t accepted, then problem only in logic of the site.

 

Scroll to top