Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^4: Losing eol character using MIME::Lite

by afoken (Chancellor)
on Dec 09, 2017 at 18:45 UTC ( [id://1205229]=note: print w/replies, xml ) Need Help??

in reply to Re^3: Losing eol character using MIME::Lite
in thread Losing eol character using MIME::Lite

Just a guess: As far as I remember, network line endings should generally be CR+LF. (See, for example, RFC5322.) When using "\n" on Unix, this generates just the LF, not CR+LF (unless MIME::Lite replaces "\n" with CR+LF). So Outlook may actually behave correct according to the letters of the RFC in refusing to accept anything but CR+LF as a line break. Yes, it's stupid, and I would expect nothing else from Outlook.

Try replacing "\n" with "\r\n" in the message body.


Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^4: Losing eol character using MIME::Lite

Replies are listed 'Best First'.
Re^5: Losing eol character using MIME::Lite
by Laurent_R (Canon) on Dec 10, 2017 at 10:00 UTC
    Thank you, afoken, it was quite long ago, but I am almost sure that I did try both LF and CR+LF (at $work, we very often have to deal with EOL differences between *nix and Windows). The strange thing is that Outlook removes some line endings but not all of them and I wasn't able to find out the underlying rule leading to that. Also, it seems that Outlook does that not only for mails prepared with Perl under *nix boxes, but even for message written on Windows platforms with an Outlook client.
Re^5: Losing eol character using MIME::Lite
by cbeckley (Curate) on Dec 11, 2017 at 13:10 UTC

    Since determining that Outlook was the problem, I've tried several things to get it to display correctly, including adding a "\r" and trying different Mime types, to no avail. Oddly, changing the contents of the string that displays directly before the timestamp sometimes causes the "\n" to display.

    Further, I've tried different email address with different clients, and from the statistically insignificant number of clients I happen to have installed on this machine, it seems to be exclusively an Outlook issue.

    Thank you to everyone who took the time to look at this.


      I had a bunch of problems with this myself with plain text e-mails from Linux systems (just text files shoved out using /bin/mail). I did bunches of translation and tried every line ending I could to get what I wanted. I think I eventually stumbled across Line breaks are removed in posts made in plain text format in Outlook. I don't know if that will help (especially since you are using MIME e-mails), but it's worth a look.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1205229]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-06-25 11:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.