Sending mail with PHP mail() function

I’ am trying to send mail with the PHP mail() function, and the function returns true so it must be send but the mail is never received in my email
// Code

if ($ok) {
$body = “{$name}
{$postcode}, {$plaats}

$to = “”;
$subject = “AZElektro”;

    if(mail($to, $subject, $body, "Content-type: text/html")){
        $messages["emailMessage"] = "Email is verzonden";
    }else {
        $messages["emailMessage"] = "Er ging iets mis: ";

echo json_encode(
        "ok" => $ok, 
        "messages" => $messages

Have you checked out all the useful information here?


Hi @Infinity
I’m assuming this still doesn’t apply to free sites. Is that correct?
I.e. No email is allowed on the free sites, or is it possible with PHPmailer?

We don’t provide webmail no.

You can use alternative services like Midagu, Zoho or GSuite.

Check the tutorial section for more information :slight_smile:

This topic was automatically closed after 2 days. New replies are no longer allowed.