0

I was wondering if anyone here with experience of PEAR mail or PEAR mail queue could help me out with this.

I am working on creating a bulk mailing service using PEAR and am adding X-headers to give information on where and when people signed up.

So am am trying to create a X-header similar to this:

X-Subscription: Subscribed on 2010/09/01, via web form, by 92.8.196.121 from http://mydomain.com/signup.htm

However after I pass the headers to PEAR mail mime and queue they are formatted with a line break at certain points so they end up looking like this:

X-Subscription: Subscribed on 2010/09/01, via web form, by 92.8.196.121 from
     http://mydomain.com/signup.htm

I have tested this by creating a few different headers and the line break always comes after a certain amount of characters but I cannot seem to find any code in PEAR which would cause this.

Does anyone here have any experience of this? Or know of a way I could fix this?

Thanks for looking

Paul Atkins
  • 355
  • 2
  • 3
  • 19
  • For anybody else having trouble with this I found the solution was to edit the maximum string length in the `encodeHeader` function inside mimePart.php – Paul Atkins Apr 14 '11 at 03:27
  • is this causing a problem for you? Technically, even headers have a maximum length. If they need to run long, starting the next line with a tab performs a continuation of the previous. – Charles Apr 14 '11 at 03:39

1 Answers1

2

The "issue" of headers being split onto multiple lines is correct behavior according to RFC 822, section "3.1.1. LONG HEADER FIELDS":

For convenience, the field-body portion of this conceptual entity can be split into a multiple-line representation; this is called "folding". The general rule is that wherever there may be linear-white-space (NOT simply LWSP-chars), a CRLF immediately followed by AT LEAST one LWSP-char may instead be inserted.

As described in What is the email subject length limit?, RFC 2822 suggests to keep a line length of 78.

Community
  • 1
  • 1
cweiske
  • 30,033
  • 14
  • 133
  • 194