0

I had a problem when i send mail with css and logo, every time mail is going to spam but when remove the css and logo it is delivered correctly in inbox.

Below is the code

$msgHtml=  "<div style='width:650px; font-family:Georgia,Arial, Helvetica, sans-serif; font-size:12px; color:#1f1f1f; background:#f9f9f9; border:1px solid #cfcfcf;'>
               <table width='650' border='0' cellspacing='0' cellpadding='4'>
               <tr>
                 <td colspan='4' align='left' valign='top' style='border-bottom:1px solid #cfcfcf;'>
                  <img  src='". base_url() ."assets/user/images/IPIX_logo_mail.jpg' alt='Emcon' alt='' /></td>
                 </tr>
               <td colspan='4'  style='height:25px; padding:0;'>
               <h3 style='font:bold 14px Georgia, Times New Roman, Times, serif ; color:#333; margin:4px 0 0 0; padding:5px 0px 5px 18px ;'>&nbsp;Hello <span style='font:bold 14px Arial, Helvetica, sans-serif; color:#222222;'>" .$fullname. "</span>,</h3>
               </td>
              </tr>
            <tr>
              <td colspan='4' style='height:8px; padding:0px ;margin:0px; border:none;'></td>
            </tr>

            <tr>
              <td colspan='4' style='font:normal 12px Arial, Helvetica, sans-serif; color:#444444; padding:4px 0px 4px 18px;'>&nbsp;Click the link below to reset your password</td>
            </tr>
             <tr>

             <td colspan='4' style='font:normal 12px Arial, Helvetica, sans-serif; color:#444444; padding:4px 0px 4px 18px;'>&nbsp;<a href='".base_url()."home/changeupasswd/".$userid."'>Click Here</a></td>

           </tr> 
              <tr>
                <td colspan='4' style='border:none; padding:8px 0 8px 20px; background:rgb(84, 215, 236); color:#fff; font-size:10px; line-height:20px; font:normal 12px Arial, Helvetica, sans-serif;'>© 2012 -13 emcon2013.com All Rights Reserved</td>
              </tr>
              </table>
            </div>";
          $sendto = $emailid;
            $from = "emailid@test.com";
            $subject = "Emcon : Reset password";
            $message = $msgHtml;
            $header = "From: " . $from . "\n";
            $header .= "Content-Type: text/html; charset=iso-8859-1\n";
            if (mail($sendto, $subject, $message, $header)) {

                echo 1;
            } else {

                echo 2;
            }
4

1 回答 1

0

将这些添加到您的标题中以验证内容是否在 html 中。

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
于 2013-04-02T06:16:38.200 回答