[Chicago-talk] Preserving whitespace in an email message

Alan Mead amead2 at alanmead.org
Mon Dec 26 11:15:49 PST 2016

You haven't given us enough information to know where the WS is going,
so any answer is speculative. But if the WS is being removed and you fix
that bug, then if you send the email as HTML with the text wrapped in
PRE tags ("<pre>YOUR-TEXT-GOES-HERE</pre>") it should solve this
problem. You could also use HTML tables (this is actually what they're
for) but in order to do so, you would need to parse the information into

These solutions may create new problems, like the text may wrap funny
for the recipient. Also, most clients use an ugly serif font to display
text in PRE tags. It's extremely hard to know what an email is going to
look like for the recipient unless you know what software the recipient
uses to read email. Most of us use multiple devices to read email these

Using MIME::Lite makes it easy to attach files.  You could also attach
these details in a format that will render correctly, like CSV (or lots
of other choices, like as an image, PDF, etc.).


On 12/26/2016 12:40 PM, Richard Reina wrote:
> I have a perl script that reads a flat file and sends it's contents in
> a text email via Mime::Lite. It works great except when there are
> whitespaces that need to be preserved for alignment. For example, If I
> have the following lines in the flat file
> James Brown 123 Washington Ave Philadephia PA
> Kim      Smith  12 5th Ave                   New York     NY
> In the received email the look like this.
> James Brown 123 Washington Ave Philadephia PA
> Kim Smith 12 5th Ave New York NY
> I have also tried converting the email to HTML which does not help.
> Any ideas what approach I should take into order to get these messages
> to format correctly?
> Thanks.
> Richard
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk


Alan D. Mead, Ph.D.
President, Talent Algorithms Inc.

science + technology = better workers

+815.588.3846 (Office)
+267.334.4143 (Mobile)


I've... seen things you people wouldn't believe...
functions on fire in a copy of Orion.
I watched C-Sharp glitter in the dark near a programmable gate.
All those moments will be lost in time, like Ruby... on... Rails... Time for Pi.

          --"The Register" user Alister, applying the famous 
            "Blade Runner" speech to software development

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20161226/1ac90d13/attachment.html>

More information about the Chicago-talk mailing list