PHP sends email, but some providers do not receive

0

I have done the function below, which does not return any error, but does not arrive in some destination emails (Yahoo for example)

function enviaEmail($titulo = '', $conteudo = '', $email = '', $nome = '') {
  $to      = $email;
  $subject = $titulo;
  $content = Reconstroi($conteudo, $nome);
  $headers = array('Content-Type: text/html; charset=UTF-8');
  $headers[] = 'From: meu site@ <[email protected]>';

  $status  = wp_mail($to, $subject, $content, $headers);
  if($status==TRUE){return 1;}else{return 0; echo"deu erro no envio do email " 
 .$status;}//return var_dump($status);
}

How to get email to the right destinations?

    
asked by anonymous 25.01.2018 / 18:47

1 answer

0

I would first try using a more complete header:

                    $to="[email protected]";
                    $subject="Título da Mensagem";
                    $from = 'Email do Sender <[email protected]>';
                    $body='Hi '.$name.', <br/><br>Now You can See Yor main in inbox';
                    $headers = "From: " .($from) . "\r\n";
                    $headers .= "Reply-To: ".($from) . "\r\n";
                    $headers .= "Return-Path: ".($from) . "\r\n";;
                    $headers .= "MIME-Version: 1.0\r\n";
                    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
                    $headers .= "X-Priority: 3\r\n";
                    $headers .= "X-Mailer: PHP". phpversion() ."\r\n";
                    mail($to,$subject,$body,$headers);
    
25.01.2018 / 19:11