Based on Email::Send::SMTP::Gmail, I infer that the module is sending in text/html rather than text/plain (that's probably a gmail default or something), so newlines alone won't be sufficient. Replace your send line with:

$mail->send(-to=>"$to", -from=>"$from", -subject=>"$subject", -body=>j +oin "<br>\n", @push_list, "total files pushed: $filecount");

I took @push_list out of the string, because it doesn't stringify the way you think it does: it doesn't automatically add \n after each element of the list just because you say "@push_list\n". I converted that to a join to make sure every element is separated by the newline. I also changed the joining from just "\n" to "<br>\n", so that there will be an HTML break between each entry, not just a newline (which HTML ignores). Finally, I included the total-count string as part of the join, to automate a line break between your list and the total at the end.

TIMTOWTDI: instead of the the join, if you changed to local $" = "<br>\n";, then the stringification you used would do almost what you wanted... you'd just have to add a <br> before your final \n as well:

local $" = "<br>\n"; $mail->send(-to=>"$to", -from=>"$from", -subject=>"$subject", -body=>" +@push_list<br>\ntotal files pushed: $filecount");

edit: bumped the create button before finishing, so finished my example

edit2: here's a link to $LIST_SEPARATOR for $".


In reply to Re: adding carriage return to gmail script by pryrt
in thread adding carriage return to gmail script by flieckster

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.