I'm having a problem with css and php mail function, and I can't figure out why parts of the styling sheet is not working.
This is my php function which sends the email to the user:
<?php
require 'dbconnection.php';
//Testing variables
$name = "laerte";
$email = "[email protected]";
$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);
?>
if i echo $message to the page, everything is fine:
no longer available.
but the message sent to my email comes like this:
no longer available.
For some reason all the styling after the title does not work, and i can't figure out why. any help or tips will be greatly appreciated.
inlineCSS. Most Email services will tear your stylesheet apart, literally.CSSto build it (as it's easier), then when you're happy with the output use a tool to convert theCSSinto inline styles as mentioned above. Almost no extra overhead dev time.