样式博士联系表格邮件


Style Php contact form mail

我想知道如何设计$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>';
                        }
                    }
                ?>

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

<style> .correct-message{font-weight:bold; color:red;}</style>