|
|
 |
Re: FN-FORUM: Email problems in PHP
date posted 7th September 2007 07:50
mail() is terrible, it encourages spammers if used badly (easy header
injection), a lot of servers are setup so mail will come from www-data
or similar instead of the actual address you want it to come from, it's
best to disable it on the server that way nobody can use it, then tell
people to use one of the better librarys or classes that build proper
valid mails:
PHPmailer
XPertMailer
Zend Mail
etc
that way you don't need to worry about creating correct headers and be
mime compliant with correct boundaries.
Martin
On 06/09/2007 22:48, James Herrington wrote:
>
> The code isn't actually mine, I've taken it over from somebody else and
> they had the base64_encode stuff in there so I'm not sure why its in
> there, although taking it out causes the email to look like this (in all
> clients):
>
> n‡r²–§²Ü¥yú'¶Ër•éè®f¥~‰í}©¢—%^Ö§iú'·¢‚[¢W_¢{l‹7µÒ›LzfÞ®Èb¥.... this
> carries on for a while
>
> I'll have a look into the PHPmailer library suggested unless anyone can
> shed any light on what's up with the mail() function?
>
> Regards,
> James
>
> Alex Townsend wrote:
>>
>> I'd firmly recommend using phpmailer (as has someone else) (
>> http://phpmailer.sourceforge.net/ ) which is fantastic. I use it all
>> the time, and have yet to have a problem with it.
>>
>> Why're you using base64? Why not just send an HTML email using
>> standard html and so on?
>>
>> I suspect that the big block of text is just a base64-encoded dollop
>> of text - have you tried using base64_decode to see what the text is
>> that the client is receiving? It's quite possible that AppleMail isn't
>> capable of handling a base64 encoded html email.
>>
>> Rememer the KISS principle - Keep It Simple (Stupid) - if the simple
>> option works for more clients, use that. In this case, plain-text html
>> email formatting, and job done.
>>
>> That's what I'd do, anyway.
>>
>>
>> James Herrington wrote:
>>>
>>> Hi all,
>>>
>>> I'm having a few problems sending out HTML emails in php. I have the
>>> HTML message stored in a variable which I then perform the
>>> chunk_split() and base64_encode() functions on. I then send the email
>>> using the mail() function. The email I receive is appearing perfectly
>>> however the client is telling me that they receive the following text
>>> in the email:
>>> *snip*
>>> Thanks in advance for any help,
>>> James
>>>
>>
>>
>
|
 |
|