我在使用 css 和 php 邮件功能时遇到问题,我无法弄清楚为什么样式表的某些部分不起作用。
这是我的 php 函数,它将电子邮件发送给用户:
<?php
require 'dbconnection.php';
//Testing variables
$name = "laerte";
$email = "someemail@gmail.com";
$title = "Some Project";
$desc = " Some description";
//adds project to MYSQL database
//The function returns uniqid generated
$id = addProject($title,$desc,$name);
$subject = "Project: ".$title;
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header .= "From: pixelgraphy.net";
$message = "<html>
<head>
<style>
body
{
width: 700px;
height: auto;
}
h1
{
background-color: blue;
color:white;
margin-top: 5px;
margin-bottom: 5px;
text-align:center;
}
#message
{
width: 500px;
height: auto;
margin-bottom: 5px;
margin-left: auto;
margin-right: auto;
}
#sign
{
background-color: blue;
color: white;
margin-top: 5px;
margin-bottom: 5px;
text-align: center;
}
</style>
</head>
<body>
<h1>Request For Feedback</h1>
<div id = 'message'>
<p>".$name." , thank you for submting your idea The project <b> ".
$title." </b> has been added to RFF's view list </p>
<a href ='www.pixelgraphy.net/assignment8/getcomments.php?id=".$id."
'>Click here</a> to view RFF's list of projects
</div>
<div id = 'sign'> Sinceraly, Anthony Paveglio & Laerte Sousa </div>
</body>
</html>";
//sends the email
mail($email,$subject,$message,$header);
?>
如果我将 $message 回显到页面,一切都很好:
不再可用。
但是发送到我的电子邮件的消息是这样的:
不再可用。
由于某种原因,标题后的所有样式都不起作用,我不知道为什么。任何帮助或提示将不胜感激。