Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 当我在邮件内容中添加样式和徽标时,邮件会变成垃圾邮件_Php_Email - Fatal编程技术网

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

Php 当我在邮件内容中添加样式和徽标时,邮件会变成垃圾邮件,php,email,Php,Email,当我发送带有css和徽标的邮件时,我遇到了一个问题,每次邮件都会成为垃圾邮件,但当删除css和徽标时,它会在收件箱中正确发送 下面是代码 $msgHtml= "<div style='width:650px; font-family:Georgia,Arial, Helvetica, sans-serif; font-size:12px; color:#1f1f1f; background:#f9f9f9; border:1px solid #cfcfcf;'>

当我发送带有css和徽标的邮件时,我遇到了一个问题,每次邮件都会成为垃圾邮件,但当删除css和徽标时,它会在收件箱中正确发送

下面是代码

$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;
            }
$msgHtml=”
您好,“$fullname”。",
单击下面的链接重置密码
©2012-13 emcon2013.com版权所有
";
$sendto=$emailid;
$from=”emailid@test.com";
$subject=“Emcon:重置密码”;
$message=$msgHtml;
$header=“From:”$从…起“\n”;
$header.=“内容类型:text/html;charset=iso-8859-1\n”;
if(邮件($sendto,$subject,$message,$header)){
回声1;
}否则{
回声2;
}

将这些内容添加到标题中,以确保内容是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";

尝试从邮件正文中删除
锚定
标记。只需将链接粘贴为文本,而不是
锚定
。这帮了我很多次。另外,看看你是否链接了一个外部样式表?