Re: output from script into email
Date: Mon, 3 Aug 2015 11:47:43 -0400
Message-ID: <CA+fnDAZTQPLFQUvNQo4k10PCVbXTUNgBD6XyE4diKR1Y=XQwRA_at_mail.gmail.com>
I'm maintaining scripts that get distributed and used across a variety of linux distributions and send output to admins who use outlook, thunderbird, mobile and some miscellaneous email clients like Claws Mail.
Few tips from my experience:
1) i use sendmail directly for better portability on linux; the "mail"
program varies on different linux platforms (even say RH5 vs RH6)
2) i write headers directly bc sendmail requires it. as Mark says, i
strongly recommend writing messages that are correct (header and body)
according to spec. then you should be fine even if someone comes
along with a new client in the future.
3) personally i prefer having the output directly in the body of the
message rather than an attachment. little easier to write a correctly
formatted email and less clicks in some email clients.
4) protip - use sed/awk to put two spaces at the beginning of each
line and outlook will treat the lines as "text" - it won't collapse
any of them together. but it won't be a monospace font, so you can't
do any multi line formatting that depends on columns lining up.
On Fri, Jul 31, 2015 at 10:56 PM, MARK BRINSMEAD
<mark.brinsmead_at_gmail.com> wrote:
> Many email readers like to treat incoming messages as HTML, and that usually
> will strip whitespace.
>
> <pre> and </pre> tags around your plain text may sometimes help.
>
> A more correct approach is probably to craft the proper MIME headers to
> explain to mail readers just what it is that you are sending. The "trick"
> with uuencoding the text probably also exploits assumptions on the part of
> your mail reader, that any block of uuencoded data is meant to be an
> attachment. While this may work for your purposes, you might find that it
> "works" (or not) quite differently for people using different email
> infrastructures.
>
> Proper use of MIME headers should work reliably for all. Once you get that
> down, you can also send nicely HTML-formatted reports if you like.
-- http://about.me/jeremy_schneider -- http://www.freelists.org/webpage/oracle-lReceived on Mon Aug 03 2015 - 17:47:43 CEST