0

我想知道如何设置 $body =" 部分的样式,以便我收到的电子邮件更易于阅读。

我已经尝试了一些东西,比如添加标签或正文标签,但似乎都不起作用,请帮我解决这个烦人的问题,

多多的问候,

昆西

<?php
                    $name = $_POST['name'];
                    $email = $_POST['email'];
                    $message = $_POST['message'];
                    $from = 'From: info@epicconcepts.nl'; 
                    $to = 'info@epicconcepts.nl'; 
                    $subject = 'Contact formulier bericht';
                    $human = $_POST['human'];

                    $headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
                    $headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
                    $headers .= "CC: quincynorbert@live.nl\r\n";
                    $headers .= "MIME-Version: 1.0\r\n";
                    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

                    $body = "
                    New Mail $name\n $email\n \n $message";

                    if ($_POST['submit']) {
                        if ($name != '' && $email != '') {
                            if ($human == '4') {                 
                                if (mail ($to, $subject, $body, $from)) { 
                                echo '<p class="correct-message">Your message has been sent!</p>';
                            } else { 
                                echo '<p class="correct-message">Something went wrong, go back and try again!</p>'; 
                            } 
                        } else if ($_POST['submit'] && $human != '4') {
                            echo '<p class="correct-message">You answered the anti-spam question incorrectly!</p>';
                        }
                        } else {
                            echo '<p class="correct-message">You need to fill in all required fields!</p>';
                        }
                    }
                ?>
4

1 回答 1

0

如果您只是使用 css 样式(如 style="correct-message") - 这将不起作用,您也应该在 body 中添加样式定义,如下所示:

<style> .correct-message{font-weight:bold; color:red;}</style>
于 2013-02-11T08:10:00.677 回答