Dear friends, I am very new to perl but having lot of intrest to learn. I just tried the below 1. Reading records from database tables and dumping into file 2. Then formating as html page and uploading the data into html page 3. Then sending as email,when i open mail it should appear in the table format with that content. like below. Name Address Number The first two scripts are working fine. But when i run the mail script, it is coming to mail, but not as the expected formate(ie table) its coming as it is html tags and data mingeled. Can someone please help me how to correct this , and what needs to be added to fix this . =================================================
#!/usr/contrib/bin/perl open (HTML, ">/tmp/pperl/index.html"); print HTML "Content-Type: text/html\n\n"; print HTML "<html><head></head><body>"; print HTML "<table border=1>"; print HTML "<tr>"; print HTML "<td width=120 BGCOLOR=#ffff00>Name</td>"; print HTML "<td width=120 BGCOLOR=#ffff00>address</td>"; print HTML "<td width=120 BGCOLOR=#ffff00>number</td>"; print HTML "</tr>\n"; open(INPUTFILE,outfile); open(HTML,">>/tmp/pperl/index.html"); while($line = <INPUTFILE> ) { ($xmit,$dc,$gcd)=split(/,/,$line); print HTML "<tr>"; print HTML "<td>$Name</td>"; print HTML "<td>$address</td>"; print HTML "<td>$number</td>"; print HTML "</tr>"; } close INPUTFILE; print HTML "</table>"; print HTML "</body></html>"; close HTML; ================================================= #!/usr/contrib/bin/perl $to='asmas@xyz.com'; $from= 'asmas@xyz.com'; $subject='First perl HTML Mail test'; open(MAIL, "|/usr/sbin/sendmail -t"); print MAIL "To: $to\n"; print MAIL "From: $from\n"; print MAIL "Subject: $subject\n\n"; print MAIL "Content-type: text/html\n\n"; open(FILE,"/tmp/pperl/index.html"); print MAIL <FILE>; close (FILE); close(MAIL);
==============================================================

In reply to Email HTML by raveendu.perl

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.