HTML email that does not display correctly for Godaddy webmail

I am using the following PHP code to send email. I tested in Outlook and other places, and everything happens correctly. However, if I send an email to a person using a web browser based on Google Godaddy, he has 2 problems:

  • FROM Email Not Displaying
  • Instead of displaying an HTML email address, it displays HTML code

This is confirmed by several accounts on different sites and browsers.

Here is the code that I use to send an email:

//build and send the email      
    $to = $email;
    $subject = 'Confirm your subscription';
    $message =( "<html>\r\n");
    $message .=( "<head>\r\n");
    $message .=( "<title>Confirm</title>\r\n");
    $message .=( "</head>\r\n");
    $message .=( "<body>\r\n");
    $message .=( "<h2>Thank You for registering</h2>\r\n");
    $message .=( "<p>To complete your registration, please click the link below.</p>\r\n");
    $message .=(" <p><a href=\"http://www.site.com/confirmation.php?confirm=$visitor_hash\">Click here to confirm your interest.</a></p>\r\n"); 
    $message .=( "</body>\r\n");
    $message .=( "</html>\r\n");

    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
    $headers .= "From: Site<info@site.com>\r\n";
    mail($to, $subject, $message, $headers);

Any thoughts?

+2
source share
2 answers

, . PHP Mail, .

3 :

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "From: Site<info@site.com>\r\n";

To

$headers  ='"MIME-Version: 1.0' . PHP_EOL;
$headers .= 'Content-Type: text/html; charset=ISO-8859-1' . PHP_EOL;
$headers .= 'From: Site<info@site.com>' . PHP_EOL;

.

,

+9

HTML MIME, . mime-. Swiftmailer PHPMailer,

0

All Articles