0

I 'm using a single form to allow my guests subscribe on my upcoming website.

My problem is that i really dont know how to make this email has some css style. I tried inline css but nothing happens. The email i receive just display the code of styling and it doesnt transform it into html!

The code i use is this:

<?php

if(isset($_REQUEST["isvalid"])){

$youremail = "info@mywebsite.com;

$usersemail = $_POST["usersemail"];

$mailsubject = "You have a new subscriber";


$message ="
<div style='width:300px;padding:20px;margin:0 auto;background:#84C318;color:#ffffff;border-radius:3px;'>
Email Address: $usersemail
</div>
"; 

$headers = 'From:' . $usersemail . "\r\n";
mail($youremail, $mailsubject, $message, $headers);
echo "success";

} else {
echo "failed";
} 

?>

I am not sure but i think i can add inline css style inside a variable. i also tried to move the inline style outside the variable but i got the same result.

Need some help here..

Designer
  • 875
  • 7
  • 26

1 Answers1

0

You need to specify that your email is a html email by setting the Content-type header to "text/html".

More information here: https://css-tricks.com/sending-nice-html-email-with-php/

Patrick Adler
  • 196
  • 2
  • 9