Here is a script example you can test php mail function with:
<?php
$to = "you@yourdomain.com";
$subject = "Hi!";
$body = "TEST";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type:text/html;charset=UTF-8\r\n";
$headers .= "From: You <you@yourdomain.com>\r\n";
if(mail($to,$subject,$body,$headers)) {
echo "MAIL - OK";
} else {
echo "MAIL FAILED";
}
?>
This script is sending an email (to you@yourdomain.com) and printing “MAIL – OK” on the page.
Tip: Please note that the ‘From’ header should be an existing email account inside your Email Manager of your Hosting Control Panel.
Keep reading
- “Outlook is unable to connect to your outgoing (SMTP) e-mail server. If you continue receiving this message, contact your server administrator or Internet service provider (ISP).”
- I cannot send/receive e-mail messages. How to fix this?
- Why I cannot receive e-mail messages after configuring my e-mail account? (It seems that the POP3/IMAP connection is not working)