Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

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
>>>
>>
>>
>



Messages by Day
September 30th 2007
September 29th 2007
September 28th 2007
September 27th 2007
September 26th 2007
September 25th 2007
September 24th 2007
September 23rd 2007
September 22nd 2007
September 21st 2007
September 20th 2007
September 19th 2007
September 18th 2007
September 17th 2007
September 16th 2007
September 15th 2007
September 14th 2007
September 13th 2007
September 12th 2007
September 11th 2007
September 10th 2007
September 9th 2007
September 8th 2007
September 7th 2007
September 6th 2007
September 5th 2007
September 4th 2007
September 3rd 2007
September 2nd 2007
September 1st 2007


Messages by Month
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000