How to check if mail() PHP function is enabled in your server

test-mail-function-adobe-museUsually, you will need mail() PHP function working in your server for advanced features in your Adobe Muse websites (like contact forms).

Best option to know if mail() PHP function is enabled in your server is contacting your hosting support.

Anyway, if you have some coding knowledge, you can test it yourself. It’s easy!

Use this code and change $from and $to values located inside double quotes.

  • $from usually will be the sender address which uses same domain as your website. Example: noreply@responsive-muse.com
  • $to will be the receiver address. This can be any email address, but be careful, sometimes free providers like GMail or Hotmail can send your emails to spam folder.
<?php
$from = "sendermeail@yourprovider.com";
$to = "destinationemail@yourprovider.com";
$subject = "Simple test for mail function";
$message = "This is a test to check if php mail function sends out the email";
$headers = "From:" . $from;
if (mail($to, $subject, $body, $header)) {
   echo("
      Message successfully sent!
   ");
} else {
   echo("
      Message delivery failed...
   ");
}
?>

How to test it:

  1. You can test what the mail() PHP function returns by copying this code and saving it in a new empty text file astestmail.php“.
  2. Edit $to and $from emails. Be careful, do not delete anything outside double quotes or you will break the code.
  3. Upload testmail.php into your root FTP folder and visit it using your browser. So if your website is http://responsive-muse.com, you will upload testmail.php to root FTP folder and visit http://responsive-muse.com/testmail.php with your browser.
  4. When visiting testmail.php you should wait some seconds and you will see a message: “Message successfully sent” or “Message delivery failed“.
    1. If you see “Message successfully sent“, check destination address and look if the email arrives to your inbox or spam folder.
    2. If you see “Message delivery failed”, you should notify this to your provider.
    3. If you see any other thing (like weird messages or errors) probably you have broken testmail.php file when editing it. Some text editors in Mac or Windows may break the code. You should use professional text editors like Sublime Text or Notepad++.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top