[PHP] HTML email enconding

2003-11-24 Thread Binay
Hi all,

Is it necessary to encode the message using base64 or quoted-printable format while 
sending the HTML email. What if i don't encode the message i.e (no 
Content-Transfer-Encoding specified)? Does it impose some security vulnerabilities? 

Please helpe me out

Thanks in advance

Binay




Re: [PHP] HTML email enconding

2003-11-24 Thread Eugene Lee
On Mon, Nov 24, 2003 at 02:56:25PM +0530, Binay wrote:
: 
: Is it necessary to encode the message using base64 or quoted-printable
: format while sending the HTML email.

Not always.  Sometimes you can get away with only:

Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

: What if i don't encode the message i.e (no Content-Transfer-Encoding
: specified)? Does it impose some security vulnerabilities? 

These headers just provide more information to the mail client so that
it can properly handle and display the message.  Some mail clients may
be more error-tolerant than others.  But really you don't want your
messages to be handled and displayed incorrectly.  Just as your PHP code
should generate HTML-compliant web pages, your code should also generate
correctly format email messages.

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



Re: [PHP] HTML email enconding

2003-11-24 Thread Binay
Hi Eugene,
Thanks for quick reply

So does it mean that if i don't encode the message then no need of
specifying the Content-Transfer-Encoding??
And almost all mail client will interpret it correctly??

Binay

- Original Message -
From: Eugene Lee [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, November 24, 2003 3:02 PM
Subject: Re: [PHP] HTML email enconding


 On Mon, Nov 24, 2003 at 02:56:25PM +0530, Binay wrote:
 :
 : Is it necessary to encode the message using base64 or quoted-printable
 : format while sending the HTML email.

 Not always.  Sometimes you can get away with only:

 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit

 : What if i don't encode the message i.e (no Content-Transfer-Encoding
 : specified)? Does it impose some security vulnerabilities?

 These headers just provide more information to the mail client so that
 it can properly handle and display the message.  Some mail clients may
 be more error-tolerant than others.  But really you don't want your
 messages to be handled and displayed incorrectly.  Just as your PHP code
 should generate HTML-compliant web pages, your code should also generate
 correctly format email messages.

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

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



Re: [PHP] HTML email enconding

2003-11-24 Thread Eugene Lee
On Mon, Nov 24, 2003 at 03:33:57PM +0530, Binay wrote:
: 
: So does it mean that if i don't encode the message then no need of
: specifying the Content-Transfer-Encoding??
: And almost all mail client will interpret it correctly??

No.  If your HTML message is guaranteed to be in the ISO-8859-1 range
(e.g. only Latin-based languages), then you could likely get away with
just these two headers.  But you still need to specify both of them.

:  Content-Type: text/html; charset=ISO-8859-1
:  Content-Transfer-Encoding: 7bit

You need to follow the various RFCs to generate correct messsages.  If
you don't have time for that, I suggest you look at existing classes
like PEAR's Mail_Mime package that does much of the work for you:

http://pear.php.net/package/Mail_Mime

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



Re: [PHP] HTML email enconding

2003-11-24 Thread Nathan Taylor
There is a nice function called sendmail available in the comments on php.net/mail.  I 
use that regularly as it inserts all the necessary headers and supports multiple 
attachments.  It's well worth considering...

Nathan
  - Original Message - 
  From: Eugene Lee 
  To: [EMAIL PROTECTED] 
  Sent: Monday, November 24, 2003 5:19 AM
  Subject: Re: [PHP] HTML email enconding


  On Mon, Nov 24, 2003 at 03:33:57PM +0530, Binay wrote:
  : 
  : So does it mean that if i don't encode the message then no need of
  : specifying the Content-Transfer-Encoding??
  : And almost all mail client will interpret it correctly??

  No.  If your HTML message is guaranteed to be in the ISO-8859-1 range
  (e.g. only Latin-based languages), then you could likely get away with
  just these two headers.  But you still need to specify both of them.

  :  Content-Type: text/html; charset=ISO-8859-1
  :  Content-Transfer-Encoding: 7bit

  You need to follow the various RFCs to generate correct messsages.  If
  you don't have time for that, I suggest you look at existing classes
  like PEAR's Mail_Mime package that does much of the work for you:

  http://pear.php.net/package/Mail_Mime

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