Dantes
Dantes

Reputation: 2891

Unable to send mail (Wordpress and AWS)

Context:

Issue:

What I tried so far:

I don't know where to look anymore. Can anyone help who faced same or similar issues?

Thanks!

Upvotes: 0

Views: 53

Answers (1)

Mayantha Jayasinghe
Mayantha Jayasinghe

Reputation: 11

Check if the phpmail function is working properly. You can use the following code to check it.

<?PHP
$sender = '[email protected]';
$recipient = '[email protected]';

$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;

if (mail($recipient, $subject, $message, $headers))
{
    echo "Message accepted";
}
else
{
    echo "Error: Message not accepted";
}
?>

  1. Create a php test file using a text editor and save it e.g. as test.php
  2. Change the $sender and $recipient in the code.
  3. Upload the php file to your webserver.
  4. Open the uploaded php file in your browser to execute the php script.
  5. The output show either "Message accepted" or "Error: Message not accepted".

If it's showing "Error: Message not accepted"Tell your provider that the standard php "mail()" function returns FALSE. It's recommended to include the used php test script to show your provider, that the problem is not caused by the php script used.

Upvotes: 1

Related Questions