Hi

Who's eating the eol? At this point I'm willing to blame the dog, but if anybody could point me toward a more likely suspect, I would greatly appreciate it. As would the dog.

Start with Basic debugging checklist

Also don't write your program in between subroutine declarations

As you can see no newlines are missing

#!/usr/bin/perl -- use strict; use warnings; use MIME::Lite; use Data::Dump qw/ dd /; my $source_heart_beat_timestamp = ''; my $target_heart_beat_timestamp = ''; $source_heart_beat_timestamp = "foo"; $target_heart_beat_timestamp = "bar"; my $output_msg = "Source Heart Beat TimeStamp: " . $source_heart_beat_timestamp . "\n +"; $output_msg .= "Target Heart Beat TimeStamp: $target_heart_beat_timest +amp"; local_do_mail("local_do_mail:\n$output_msg"); $source_heart_beat_timestamp = "20171207_113255"; $target_heart_beat_timestamp = "bar"; $output_msg = "Source Heart Beat TimeStamp: " . $source_heart_beat_timestamp . "\n +"; $output_msg .= "Target Heart Beat TimeStamp: $target_heart_beat_timest +amp"; local_do_mail("local_do_mail:\n$output_msg"); exit 0; sub local_do_mail { my ($msg_body) = @_; my $msg = MIME::Lite->new( From => 'cloudops@example.com', To => 'cbeckley@example.com', Subject => 'testing missing eol', Data => $msg_body ); #~ $msg->send; #~ $msg->print; dd( $msg->as_string ); } __END__ "Content-Disposition: inline\nContent-Transfer-Encoding: 8bit\nContent +-Type: text/plain\nMIME-Version: 1.0\nX-Mailer: MIME::Lite 3.029 (F2. +84; T2.04; A2.12; B3.14; Q3.13)\nDate: Fri, 8 Dec 2017 19:41:07 -0800 +\nFrom: cloudops\@example.com\nTo: cbeckley\@example.com\nSubject: te +sting missing eol\n\nlocal_do_mail:\nSource Heart Beat TimeStamp: foo +\nTarget Heart Beat TimeStamp: bar" "Content-Disposition: inline\nContent-Transfer-Encoding: 8bit\nContent +-Type: text/plain\nMIME-Version: 1.0\nX-Mailer: MIME::Lite 3.029 (F2. +84; T2.04; A2.12; B3.14; Q3.13)\nDate: Fri, 8 Dec 2017 19:41:07 -0800 +\nFrom: cloudops\@example.com\nTo: cbeckley\@example.com\nSubject: te +sting missing eol\n\nlocal_do_mail:\nSource Heart Beat TimeStamp: 201 +71207_113255\nTarget Heart Beat TimeStamp: bar"

Count the \n there are 2 in both messages

"local_do_mail:\nSource Heart Beat TimeStamp: foo\nTarget Heart Beat T +imeStamp: bar" "local_do_mail:\nSource Heart Beat TimeStamp: 20171207_113255\nTarget +Heart Beat TimeStamp: bar"

So who is to blame? The destination displaying the email body.


In reply to Re: Losing eol character using MIME::Lite by Anonymous Monk
in thread Losing eol character using MIME::Lite by cbeckley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.