2015-10-26 1 views
0

J'ai une question sur la fonction de messagerie PHP. Pendant que je l'utilise, il n'envoie que des emails qui sont détectés comme spam, et changer ou ajouter des en-têtes ne fait aucune différence.Fonction de messagerie PHP envoyer uniquement du spam

Voici mon code:

  $to  = $email; 
      $subject = "The Subject"; 
      $message = "This is a message<br/> 
         This is another line<br> 
         And another line..<br>"; 
      $headers = "From: [email protected]\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 .= "Reply-To: [email protected]\r\n"; 
      $headers .= "Return-Path: [email protected]\r\n"; 

      mail($to, $subject, $message, $headers); 

Quelqu'un pourrait-il s'il vous plaît me aider?

+0

serait mieux si vous utilisez Php-Mailer atleast. –

Répondre

0
Use $headers = "From: [email protected] \r\n"; 
    instead of 
$headers = "From: [email protected]\r\n"; 
          OR 
    Use the following: its working fine for me: 
    $touser=$email; 
    $subjectAdmin= "demo"; 
    $headersAdmin = "From: [email protected]\r\n"; 
    $headersAdmin .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
    $messageuser ='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 
    Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
    <html lang="en"> 
    <head> 
    <title>demo</title> 
    </head> 
    <body> 
    <div style="margin:0 auto;"> 
    <p>message</p> 
    <div style="clear:both;font-size:14px; text-align:left; width:100%;"> 
    <br/> 
    </div> 
    </div> 
    </body> 
    </html>'; 
    $emailSenduser = mail($touser,$subjectAdmin,$messageuser,$headersAdmin);