如何风格的php电子邮件形式的身体? [英] How to style a php email form body?

查看:165
本文介绍了如何风格的php电子邮件形式的身体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个php表单。当我收到提交的表单电子邮件,我应该得到它视觉上漂亮的外观。

I am trying to create a php form. When I get the submitted form on email I should get it visually nice look.

如果放下面的代码我得到这个![email body] [1]

If put the following code I get this ![email body][1]

$mailBody=" <html>
                <body>
                    <table border=\"1\" style=\"width:100%\">
                        Name: $name_title $sender\n
                        Email: $senderEmail\n\n
                        $message
                    </table>        
                </body>
            </html>";

当我得到我的PHP表单时,如何获得一个漂亮的scc表或div像html文档?

How can I get a nice scc table or div like a html document when I get my php form?

推荐答案

<?php

$to  = "some@example.comsome1@exmple.com,some3@example.com";
$subject = 'Hello World';

// 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";
// More headers
$headers .= 'From: <me@some.com>' . "\r\n";

$msg =   '<html>';
$msg .= '<head>
   <h2 style="font-family:verdana;text-align:center;background-color:red">Hello World</h2>
   </head>
  <table border="3" cellspacing="2">
  <tr style="font-family:verdana;background-color:#6d6d6d">
       <th>col1</th>
       <th>col2</th>
       <th>Col3</th>
       <th>Col4</th>
   </tr>';
//do something here fetch or send static body

$msg .= "<tr>";
$msg .="<td>" . fetch from db/or static body. "</td>";
$msg .= "<td>" .fetch/ static. "</td>";
$msg .= "<td>" .fetch/static  . "</td>";
$msg .= "</tr>";

$msg .= '</table>';      
$msg .= '</html>'; 

mail($to, $subject, $msg, $headers); 
?>

这篇关于如何风格的php电子邮件形式的身体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆