Re: email with style (again)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 26, 2008 at 8:33 PM, tedd <tedd.sperling@xxxxxxxxx> 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); } ?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux