php mail() function is not working

Asked

Viewed 391 times

0

I’m using the function mail() PHP to try to send some data that is informed in my form; the function is returning true only the email never reaches the recipient. Below is the PHP code:

$headers = 'From: ServidorCafé <[email protected]>'."\r\n" .
        'MIME-Version: 1.0' . "\r\n".
        "Return-Path: contato <[email protected]>\r\n".
        'Content-type: text/html; charset=UTF-8' . "\r\n";


        $envia = mail('[email protected]', 'Pesquisa preenchida', $corpo, $headers);

        if($envia){

            echo '<div align="center" style="height:30px;width:100%; background-color:green; color:#fff; font-size:13px; font-family:Verdana">Mensagem enviada com sucesso!</div>';
        }

in $body is the HTML form I made with <table>

  • Have you seen the spam box? If the addressee is Hotmail, every email sent by the mail will go to spam. Switch to a gmail addressee. See the PHP version of your server if it is 5. NOTE:

  • Not in spam. Version 5 of PHP.

  • Wait. I’ll send you a code.

  • Try to remove the accent in Servorcafé. I’ve had problems with special characters in sending email.

  • @Alissonacioli Why function mail returned TRUE does not mean that the email reached the recipient, it just means that it reached the "email service" of your server and probably got in the queue (correct me if I’m wrong). There is a probability of having a problem with your SMTP, or in Hotmail the "IP of your server" is blocked (it is only theory). Have you ever thought of using an SMTP instead of mail? Many developers go through these difficulties with the function mail.

  • Where are you testing? Location? Server? Where is hosted?

Show 1 more comment

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.