Hi Everyone,

I am a newbie to perl and have been facing issue when sending email via my perl script. The script I have generates a list of patches failing to meet some specific criteria. The list of patches is printed and placed at the output directory of the apache server.

My job requires me to send this list as an email to my co-workers. I am using the code below for this purpose

sub email_report{ my $subject='Excluded checkins after lockdown mode' ; my $mail='xxx@yyy.com'; open MAIL,">/home/mfali/Workscripts/tmpfile.html" || die $!; print MAIL "From:zzz@vvv.com\n"; print MAIL "To: $mail\n"; print MAIL "Subject: $subject\n"; print MAIL "Mime-Version: 1.0\n"; print MAIL "Content-Type:text/html\n"; open REPORT, "/home/mfali/public_html/my_report1/out.html" || die $!; while (<REPORT>) { print MAIL $_ ; } close REPORT; close MAIL; # Send the email system("/usr/lib/sendmail -t -oi < /home/mfali/Workscripts/tmpfile.h +tml"); }

When I look at the format of the patches either in the apache output directory or if I look the tmpfile.html , then the format looks correct. But when the same list comes through email, it's format is getting corrupted. I have been trying to resolve this issue for the past 2-3 days and have not been successful. I am not allowed to install any modules and either have to use the core modules or use sendmail. Can some one please suggest me as to how can i effectively send a report in the email keeping its format intact.

Using thunderbird mail client, with perl, v5.6.1 built for i686-linux.

Thanks
Faizan

In reply to Email format issue by mfali

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.