Hello,
I'm trying to send an html formatted e-mail via PHP and have run into some problems. I haven't found much on the internet about which tags are supported. My hope was that I could send an HTML formatted e-mail with PHP that is as rich as any web page, complete with CSS styles, layout tables, images and text formatting of my choice.
Is this the case? If so, can someone direct me to a reference or lend me some clarification?
Thanks in advance.
Sleeve
PHP supported HTML tags and E-mail
Moderator: General Moderators
the mail client decides how it treats the mail not the server-side php-script.
So for example in outlook express the internet explorer engine is used to display html-mail, in mozilla the gecko engine ...and so on. Some security settings might be in effect but besides that it's just another html-document to display
So for example in outlook express the internet explorer engine is used to display html-mail, in mozilla the gecko engine ...and so on. Some security settings might be in effect but besides that it's just another html-document to display
thanks for the reply Volka
That is exactly what I thought too, but when I debug the script I made, I get errors. Here is an example script:
If I use any HTML tags in the body such as:
I get errors when debugging and the script doesn't work.
Any thoughts on this?
That is exactly what I thought too, but when I debug the script I made, I get errors. Here is an example script:
Code: Select all
<? $to = "$sendTo"; $subject = "Important Message";
// your message is now in HTML
$message = "
<html>
<head>
<title>message</title>
</head>
<body>
vaiables and so fourth
</body>
</html>
";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: You <you@you.com>\r\n";
$headers .= "Cc: notyou@you.com\r\n";
$headers .= "Reply-To: $s_name <$s_mail>\n";
$headers .= "X-Mailer: PHP/" . phpversion() . "\n";
$headers .= "X-Priority: 1";
mail("$to", "$subject", "$msg", "$headers");
echo "finished!";
?>Code: Select all
<tr>
<td width="725" height="21"> </td>
</tr>Any thoughts on this?
something specific?I get errors
but probably you have problems with nested "s in a double-quoted string literal.
Take a look at the colors the higlighter uses here
Code: Select all
// this produces errors
$message = "
...
<td width="725" height="21"> </td>
...";Code: Select all
// escaping "s within the literal
$message = "
...
<td width="725" height="21"> </td>
...";Code: Select all
// using single-quoted literal (no variable substitution)
$message = '
...
<td width="725" height="21"> </td>
...';
Last edited by volka on Sun Mar 30, 2003 4:48 pm, edited 1 time in total.
ooops, I was too slow. take a look at my last post ....and http://www.php.net/manual/en/language.types.string.php