Re: mail() problem
From: Manuel Lemos (mlemos_at_acm.org)
Date: 01/19/05
- Next message: Matt: "Re: mail() problem"
- Previous message: Grunff: "Re: Problem with rewritten URLs"
- In reply to: Matt: "Re: mail() problem"
- Next in thread: Matt: "Re: mail() problem"
- Reply: Matt: "Re: mail() problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 19 Jan 2005 00:28:53 -0200
on 01/18/2005 09:33 PM Matt said the following:
>>on 01/06/2005 11:54 PM Matt said the following:
>>>I'm constructing html emails using a php script. I created a program
>>>that creates the html code perfectly and displays it to the screen as a
>>>preview. one part of the program takes the output of the preview and puts
>>>it into a file to zip it. This portion works fine. The variable has all
>>>the html code and the zipped file unzips to the correct html file. I
>>>then created a program to email this html code as the body of an email.
>>>This is where I had a problem. I was using phpmailer and it worked fine
>>>the first time. during another try w/ different information in the html
>>>code (but same html code) there were added and removed characters, and
>>>most notably, an 
 and 
, which I believe is a CR/LF. there are
>>>some added ! throughout the code and a few removed letters. they do NOT
>>>correspond to variables that go into the html. they are in the middle of
>>>the hard coded section. I tested the variable by displaying the body
>>>variable after emailing it and it works fine. I tried the same process
>>>using mail() instead of phpmailer, and I got the same results. I sent
>>>the email to another account and instead of 
 and 
 the code
>>>started on the next line. either way this does not view correctly in an
>>>email client! does anyone have any suggestions??
>>You should not send HTML only messages because most spam filters will
>>discard your messages for not looking like real messages sent by human
>>users. Human users use normal mail programs that can send HTML messages
>>but also include an alternative text part.
>>
>>Anyway, your problem seems to be due to incorrect encoding. Plain text or
>>HTML messages should be encoded with quoted-printable encoding. That
>>encoding avoids all the problems you mentioned.
>>
>>If you do not know how to encode with quoted-printable encoding, you may
>>want to try this popular MIME message composing and sending class that not
>>only supports quoted-printable encoding but also can compose HTML messages
>>with alternative text parts. Take a look in particular to the example
>>script test_html_mail_message.php .
>>
>>http://www.phpclasses.org/mimemessage
>
> Thanks for the reply. I've been playing with it some more. First off, i
> wordwrapped the body at 72 characters. That fixed MOST of the problems, but
> now i get a space removed from the HTML code. I now encode the body in
> base64, but i think that's different than using quoted-printable encoding.
> Should i encode it in php or just put it in the header so the mail program
> reads it better?
Most modern spam filters discard text/plain or text/html message encoded
as base64. That is because real mail client programs never use base64
except for binaries. So base64 encoding is a pattern of messages used by
spammers to make it more difficult to look inside messages.
quoted-printable encoding already takes care of breaking the lines of
the encoded text without altering the contents of the decoded text.
I suggest that you follow the standards and do not bother to re-invent
the wheel. Using existing components for generating and sending e-mail
correctly composed will save you countless hours of trying to figure how
to send messages without the inconvinients that are you facing and
others that you are still not aware.
-- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html
- Next message: Matt: "Re: mail() problem"
- Previous message: Grunff: "Re: Problem with rewritten URLs"
- In reply to: Matt: "Re: mail() problem"
- Next in thread: Matt: "Re: mail() problem"
- Reply: Matt: "Re: mail() problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|