[FX.php List] How to send HTML emails in PHP
DC
dan.cynosure at dbmscan.com
Fri Jan 25 09:00:14 MST 2008
hi bob,
each mailserver and each reader has their own little quirks about
linefeeds and other minutiae. the email libs will generally smooth that
stuff out for you. so...
now you've know the specific "thing" it takes to get an HTML email to
send (the header describing the MIME "part") i'd recommend checking out
SwiftMailer:
http://www.swiftmailer.org/
it's a big library, but it will give you room to grow - for instance,
when your client says something like...
"bob, we want to have our logo (or other image) embedded *in* the email
rather than loaded from our website. can you do that?"
i have used Pear MIME email package and I left it because there was a
serious bug that annoyed the crap out of me:
http://pear.php.net/bugs/bug.php?id=2952
the issue has been fixed now, but the arrogance of the pear Mail_mime
developer (at the time) was astounding - see bug report comments for the
legions of developers pleading for a patch.
i've moved on from the pear library.
finally, make sure you delve into http://campaignmonitor.com for great
advice, stats, and templates for HTML email programs.
dan
Bob Patin had written:
> Troy,
>
> Thanks for the response; here's the top of my email code:
>
> $header .= "From: Advanta-STAR <info at client.com>\r\n";
>
> $header .= "Content-Type: text/html; charset=iso-8859-1;\r\n\r\n";
>
> $body.'<html xmlns="http://www.w3.org/1999/xhtml">';
> $body = $body.'<body>';
>
> I tried removing one of the pairs of \r\n in the 2nd header line, but it
> didn't make a difference...
>
> Is it possibly that I have those HEAD tags?
>
> BP
>
>
> On Jan 24, 2008, at 6:43 PM, Troy Meyers wrote:
>
>> Bob,
>>
>> The message ID belongs in the header. It could be that it's being
>> generated after the header ends, or that there's a stray extra
>> linefeed that makes the mail client think the header is over. Do you
>> see it in the headers when you View Header as well?
>>
>> -Troy
>>
>>
>>
>>> This line appears above the logo, which should be the first thing in
>>> the email:
>>>
>>> Message-Id: <20080124230714.ED37E1D9A64 at localhost> Date: Thu, 24 Jan
>>> 2008 17:07:14 -0600 (CST)
>>>
>>> Any thoughts? It looks like it's created by the mail client; I don't
>>> see it in Mac Mail, but it does appear in Entourage, and in Outlook
>>> Express on the PC.
>>>
>>> BP
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list