duanbi9202 2014-01-27 12:53
浏览 35

PHPMailer嵌入式样式不起作用

when I send mail through PHPmailer it comment the embedded style sheet. When I receive the mail it style sheet has been commented.

mail content

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>webandcrafts mail system</title></head><body><style>
        body,html{ width:100%; height:100%;}
        body{ margin: 0; padding: 0; font-size: 14px; color: #4b4b4b; font-family: 'Lato', sans-serif; line-height: 24px;}
        body p{ text-align: justify;}
        a{ text-decoration: none; color: inherit; font-size: inherit; font-style: inherit;}
        #wrapper{ background: #ececec;}
        #container{ width: 800px; height: 1207px; margin: 0 auto; background: #FFF url(images/main-img.jpg) right top no-repeat;}
        .content{ width: 470px; float: left; padding: 60px 0 0 35px;}
        h1{ font-size: 27px; line-height: 40px; font-family: 'Source Sans Pro', sans-serif; width: 395px; color: #313f47; font-weight: normal; margin: 40px 0;}
        .first-para img{ float: left;}
        .first-para p{ width: 270px; float: right; margin: 0; font-style: italic; margin-top: 3px;}
        .text-content p{ font-style: italic; margin: 15px 0;}
        .text-content p:first-of-type{ margin-top: 5px;}
        .text-content p:last-of-type{ float: right; margin: 0;}
        .text-content a{ color: #c10a0a;}
        hr{ width: 100%; height: 0; border: none; border-top: 1px dotted #b0b0b0; margin: 10px 0 0 0;}
        .bottom{ position: relative;}
        .bottom img{ margin-top: 15px; float: left;}
        .bottom a{ font-family: Tahoma; color: #4b4b4b; position: absolute; right: 0; bottom: 0;}
        .clear{ clear: both;}
</style>
<div id="wrapper">test mail</div>

Mail that I received in gmail

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>webandcrafts mail system</title></head><body><style><!--
        body,html{ width:100%; height:100%;}
        body{ margin: 0; padding: 0; font-size: 14px; color: #4b4b4b; font-family: 'Lato', sans-serif; line-height: 24px;}
        body p{ text-align: justify;}
        a{ text-decoration: none; color: inherit; font-size: inherit; font-style: inherit;}
        #wrapper{ background: #ececec;}
        #container{ width: 800px; height: 1207px; margin: 0 auto; background: #FFF url(images/main-img.jpg) right top no-repeat;}
        .content{ width: 470px; float: left; padding: 60px 0 0 35px;}
        h1{ font-size: 27px; line-height: 40px; font-family: 'Source Sans Pro', sans-serif; width: 395px; color: #313f47; font-weight: normal; margin: 40px 0;}
        .first-para img{ float: left;}
        .first-para p{ width: 270px; float: right; margin: 0; font-style: italic; margin-top: 3px;}
        .text-content p{ font-style: italic; margin: 15px 0;}
        .text-content p:first-of-type{ margin-top: 5px;}
        .text-content p:last-of-type{ float: right; margin: 0;}
        .text-content a{ color: #c10a0a;}
        hr{ width: 100%; height: 0; border: none; border-top: 1px dotted #b0b0b0; margin: 10px 0 0 0;}
        .bottom{ position: relative;}
        .bottom img{ margin-top: 15px; float: left;}
        .bottom a{ font-family: Tahoma; color: #4b4b4b; position: absolute; right: 0; bottom: 0;}
        .clear{ clear: both;} 

--> Test Mail

  • 写回答

2条回答 默认 最新

  • douzaoqu4447 2014-01-27 13:00
    关注

    Your <style> tag should be in your <head>. Not in your <body>.

    评论

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思