Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

mkboy

PHP Mail: Content-type, problemas em e-mail terra

Recommended Posts

Olá,

 

Envio e-mail utilizando a função Mail() do PHP.

A mensagem vai em HTML, até então sem problemas.

 

Porém, tenho uma cliente que recebe e-mails no terra @terra.com.br , e para ela o HTML não interpreta, então ela recebe um código fonte como mensagem.

 

Estou enviando conforme o manual do PHP, o que posso fazer?

 

http://php.net/manual/pt_BR/function.mail.php

 

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

1) O problema são em todos os clientes @terra.com.br?

2) O problema é somente em um cliente que possui @terra.com.br?

3) Pode ser uma configuração do cliente de caixa de entrada dele não ler o e-mail como HTML

4) Ele acessa por algum cliente (outlook, programa de e-mail..) ?

 

Algumas variáveis possíveis.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá Paulo,

 

Assim, até a semana passada eu enviava com componente ASP, essa semana migrei para o PHP Mail, antes eles recebiam em HTML normal, agora não recebem.

 

Acessa direto pelo webmail.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tente utilizar a biblioteca PHPMailer, ela irá simplificar e resolver várias questões da função mail.

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por gibagehrke
      Bom dia galera, estou terminando um site, porém no formulário de contato que estou utilizando o PHP mail, após enviar o e-mail ele mostra todo o log do envio ao invés de mostrar apenas a mensagem de enviado com sucesso, value pela ajuda! 
       
      <?php date_default_timezone_set('Etc/UTC'); require 'PHPMailerAutoload.php'; $erros = ""; //Create a new PHPMailer instance $mail = new PHPMailer; //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = 2; //Ask for HTML-friendly debug output $mail->Debugoutput = 'html'; //Set the hostname of the mail server $mail->Host = 'smtp.dualtec.com.br'; // use // $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6 //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission $mail->Port = 587; //Set the encryption system to use - ssl (deprecated) or tls $mail->SMTPSecure = 'tls'; //Whether to use SMTP authentication $mail->SMTPAuth = true; //Username to use for SMTP authentication - use full email address for gmail $mail->Username = 'usuario'; //Password to use for SMTP authentication $mail->Password = 'senha'; //Set who the message is to be sent from $mail->setFrom('remetente','CONTATO DO SITE'); //Set an alternative reply-to address //$mail->addReplyTo('replyto@example.com', 'First Last'); //Set who the message is to be sent to $mail->addAddress('destinatario'); //Set the subject line $mail->Subject = $_POST['assunto']; //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); //Replace the plain text body with one created manually $mail->Body .= '<div style="margin:0 auto;padding:0;width:500px;">'; $mail->Body .= '<h1 style="float:left;color:#000;padding:8px 40px;">Contato pelo site</h1>'; $mail->Body .= '</div>'; $mail->Body .= '<div style="clear:both;background:#f7f7f7;border-radius:10px;box-shadow:-2px 2px 2px #B6B6B6 , -2px -2px 2px #B6B6B6 ,-2px 2px 2px #B6B6B6 ,2px -2px 2px #B6B6B6;">'; $mail->Body .= '<h2 style="padding:15px; font-size:16px; color:#07335F; background-color:#FFCE4A; -webkit-border-top-left-radius: 10px; -webkit-border-top-right-radius: 10px; -moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;border-top-left-radius: 10px; border-top-right-radius: 10px;">Dados do formulario de contato</h2>'; $mail->Body .= '<h3 style="padding:5px 15px; font-size:16px;"><strong style="color:#07335F";font-weight:bold;>Nome:</strong>' .$_POST['nome'] .'</h3>'; $mail->Body .= '<h3 style="padding:5px 15px; font-size:16px;"><strong style="color:#07335F";font-weight:bold;>E-mail:</strong>' .$_POST['mail'] .'</h3>'; $mail->Body .= '<h3 style="padding:5px 15px; font-size:16px;"><strong style="color:#07335F";font-weight:bold;>Telefone:</strong>' .$_POST['fone'] .'</h3>'; $mail->Body .= '<h3 style="padding:5px 15px; font-size:16px;"><strong style="color:#07335F";font-weight:bold;>Empresa:</strong>' .$_POST['empresa'] .'</h3>'; $mail->Body .= '<h3 style="padding:5px 15px; font-size:16px;"><strong style="color:#07335F";font-weight:bold;>Assunto:</strong>' .$_POST['assunto'] . '</h3>'; $mail->Body .= '<h3 style="padding:5px 15px; font-size:16px;"><strong style="color:#07335F";font-weight:bold;>Mensagem:</h3>'; $mail->Body .= '<p style="text-align:justify;padding:5px 15px;color:#000;">'; $mail->Body .= $_POST['mensagem'] .'</p>'; $mail->Body .= '</div>'; $mail->Body .= '</div>'; ////$mail->Body = $_POST['mensagem']; //$mail->AltBody = $_POST['texto']; //Attach an image file //$mail->addAttachment('images/phpmailer_mini.png'); //send the message, check for errors $send = $mail->Send(); if($send){ echo '<div>'; echo '<p><h1>Sua Mensagem foi enviada com sucesso.</h1></p>'; echo '</div>'; }else{ echo '<div>'; echo '<p><h1>Não foi possível enviar a mensagem.<ha/h1>'; echo '</div>'; } ?>  
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.