Re: email with style (again)
| From: | Daniel Brown | Date: | Wed, 27 Feb 2008 15:14:24 +0000 |
| Subject: | Re: email with style (again) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270302@lists.php.net to get a copy of this message | ||
On Tue, Feb 26, 2008 at 8:33 PM, tedd <tedd.sperling@gmail.com> wrote:
> Ok gang:
>
> What's wrong with the following code?
[snip!]
The placement was wrong with the content-type info, that's all.
It should be in the headers, after your from/x-mailer/blah/blah/blah
envelope information. Also, when starting a long string, the first
entry doesn't need to be dotted. In fact, if that variable was
elsewhere populated already, you'll append on to that, rather than
re-instantiating the variable. Of course, there's also HEREDOC to
consider.... but that's for a different email. Here's the reworked
(and working - tested and all) code:
// Common Headers
$headers = "From: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;
// HTML Version
$headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
$headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$msg = $body.$eol.$eol;
--
</Dan>
Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>