Testing email sending capability of your server


#1

If you find that email is not delivering. You can test this way whether your server is capable to send email. Write a php script with following contents-

<?php
$to = '[email protected]'; # Use your own email address
$subject = 'Testing';
$message = 'Hello world!';
$headers = 'From: [email protected]' . "\r\n" .
    'CC: [email protected]';

if(mail($to,$subject,$txt,$headers)){
    echo 'Email sent'; # Mail function is enabled in your server and PHP tried to send email.
    // It still depends on the receipt server whether it accept the email or mark as spam.
}
else{
    echo 'Sending email does not work';
}

Another option is using SMTP.

In ClodOnex we have used PHPMailer-

And SMTP credentials are stored in Database.
To enable SMTP for sending Email.
Go to Settings > Email Settings
In Settings choose SMTP.

SMTP is better as it will increase chance the email will be send to Inbox instead of SPAM or Junk Folder.