php mail function () is not working

0

I am using the mail() function of 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>

    
asked by anonymous 09.12.2014 / 21:23

1 answer

1

@Alisson, I managed to solve this problem with class phpmailer, it allows and very simple to use and only needs php5 +.

Here is an example of how to use: link

Here are the frequently asked questions about stackoverflow that can solve these questions: link

The method of sending phpmailer is widely recommended and is much better than sending mail () as the standard PHP function.

    
09.01.2015 / 17:08