Re: Missing trailing newline on de-MIMEd mail

Jason L Tibbitts III <[email protected]> 17 Nov 2007 13:13:25 -0600
Newsgroups gmane.mail.majordomo.majordomo2.devel
Message-ID <[email protected]>
>>>>> "JL" == John L <[email protected]> writes:

JL> The problem is that Yahoo mail sends multipart mail where their
JL> tag in the formatted part at the end doesn't end in a new-line.

Yeah, the final newline is explicitly not part of the attachment, so
that a single line can be split over multiple MIME sections with
different encodings.

JL> When the message is sent to qmail, my MTA, it spits it back,
JL> correctly complaining that there's no newline at the end as RFC821
JL> requires.

Well, RFC821 governs SMTP, and our SMTP module automatically adds the
trailing newline as required by the standard:

  # If we didn't end the last line with a newline, we need to add one
  # now or we may hang forever.
  unless ($self->{'sentnl'}) {
    $self->send('');
  }

JL> If you don't use qmail, you probably haven't noticed this because
JL> the SMTP submission used with other MTAs adds the newline at the
JL> end sort of by accident.

Not at all by accident.

The problem is that I don't think we talk to qmail via SMTP.  So qmail
has no leg to stand on when it comes to rejecting things due to
violation of RFC821.  Whatever talks to qmail needs to ensure that it
talks to qmail in whatever way qmail wants to be talked to.

JL> For now, I've slapped a band-aid into QQEnvelope.pm that opens the
JL> outgoing mail file, checks the last character, and adds a \n if
JL> needed, but that's gross.

Well, that would seem to be the proper place for it as far as I can
tell.

 - J<