带有foreach循环的php邮件功能中的样式错误

时间:2016-07-09 11:53:31

标签: php css email

我正在尝试将邮件发送到未付订单的用户列表。

我在foreach循环中获取订单,并且还为元素添加了内联样式。风格在前端很好用。见下文: enter image description here

但是在电子邮件中有一些没有样式的链接。 enter image description here

这是我的代码:

foreach($sid as $si) { 
                    $message .="<li style='padding: 7px;width:90%;'>Order Number: ".$si."<A style='background: #E68126; color: #fff ; text-decoration: none; padding: 5px 10px; float: right;' href='#'>View Order</A></li><br>";
                 } 

我正在使用带有自定义标题的php mail函数。

完整的HTML:

 $message = // contents of report in $message
    "
    <html>
    <head></head>
    <body>
       <div style='background:rgb(242,242,242) none repeat scroll 0% 0%;font-family:Verdana, Geneva, sans-serif;padding:6% 10%;font-size:14px;font-weight:400;color:rgb(0, 0, 0);'>
        <div style='background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 2px solid rgb(0, 0, 0); padding: 20px;font-family:Verdana, Geneva, sans-serif;'>
        <IMG style='padding: 10px 0px;' SRC='sample.png'/>
        <hr style:'border:1px solid #000;'><BR><h2 style='color: rgb(0, 0, 0);font-weight:bold;font-size:22px;text-align:center;text-transform:uppercase;font-family:Verdana, Geneva, sans-serif;' >Order Unpaid</h2>
        <span style='display: block; font-size: 18px; color: rgb(0, 0, 0); padding: 10px 0px;font-family:Verdana, Geneva, sans-serif;'>Hello ,</span>
             <span style='display: block; color: rgb(0, 0, 0), 120); padding: 10px 0px;font-family:Verdana, Geneva, sans-serif;'>There are unpaid orders in your account.</span>";
                foreach($sid as $si) { 
                    $message .="<li style='padding: 7px;width:90%;'>Order Number: ".$si."<a style='background: #E68126; color: #fff !important; text-decoration: none !important; padding: 5px 10px !important; float: right !important;' href='https://www.test.com/index.php/order/view/id/".$si."'>View Order</a></li><br>";
                 } 
            $message .= "<span style='display: block; padding: 10px 0px 20px; rgb(0, 0, 0);font-family:Verdana, Geneva, sans-serif;'><br>You can view orders in your account information.<br></span><br> <A STYLE='color: #ffffff; background: #E68126 ; text-decoration: none; padding: 12px 19px; border-radius: 6px; width: 200px; text-align:center; margin: 3px auto; display: block; font-size: 15px; text-transform: uppercase;font-family:Verdana, Geneva, sans-serif;' href='https://www.test.com/index.php/order/index/type/1' target=_blank>View Account</A><span style='display: block; padding: 20px 0px 10px; color: rgb(0, 0, 0); line-height: 25px;font-family:Verdana, Geneva, sans-serif;'><br>If the request was sent not by you, on your petition or without your permission please inform to our security service via support@test.com.</span><span style='display: block; padding: 30px 0px 0px; font-size: 12px; color: rgb(0, 0, 0);font-family:Verdana, Geneva, sans-serif;'>Happy shopping, </span><span style='display: block; padding: 9px 0px 10px; font-size: 13px; color: rgb(0, 0, 0);font-family:Verdana, Geneva, sans-serif;'>Always welcome Test team</span><hr style:'border:1px solid #000;'><span style='display: block; padding: 9px 0px 10px; font-size: 14px; text-align:center; color: rgb(0, 0, 0);font-family:Verdana, Geneva, sans-serif;'> © 2015 Test technologies ltd</span></div></div></body></html>";

0 个答案:

没有答案