solunatec
asked on
how to add nice formatting/css etc. to php internet email
I am putting forward this small example to ask how to add styling to php internet email..::
$to='ag@groos.net';
$body=$account_name;
$subject = "HTML email";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers = "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// More headers
$headers .= 'From: <admin@groos.net>' . "\r\n";
$headers .= 'Cc: ag@groos.net' . "\r\n";
mail($to,$subject,$message,$headers);
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
<style type='text/css">
did not work, gave me an error in my editor...and browser
plain old <style> did though....???
did not work, gave me an error in my editor...and browser
plain old <style> did though....???
What editor? What error?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
The error is double quotes,
I replaced it with single quote.
I replaced it with single quote.
Yes, Thanks for that.
ASKER
Yes it was the double quotes: thanks everyone....
Double quote have never given an error, nor in Netbeans nor in browser (any browser)... not in my experience.
"The most important feature of double-quoted strings is the fact that variable names will be expanded." (http://php.net/manual/en/language.types.string.php)
Cheers
"The most important feature of double-quoted strings is the fact that variable names will be expanded." (http://php.net/manual/en/language.types.string.php)
Cheers
Ooops, I didn't thought to the others double quotes which styles ones were wrapped in!. I'm sorry.
like this :
Open in new window
And take a look here : http://www.campaignmonitor.com/css/