dpleylxzx47207117 2013-04-02 06:12
浏览 17

当我在邮件内容中添加样式和徽标时,邮件会转到垃圾邮件

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 . "
";
            $header .= "Content-Type: text/html; charset=iso-8859-1
";
            if (mail($sendto, $subject, $message, $header)) {

                echo 1;
            } else {

                echo 2;
            }
  • 写回答

1条回答 默认 最新

  • doubinei1457 2013-04-02 06:16
    关注

    Add these to your header to verfiy that the contents is in html.

    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "
    ";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
    ";
    
    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题