Hi Monks!

My program sends HTML email no problem, but now I need to include a little logic inside of the "Data => qq| |,", I am using MIME::Lite, it works, but I need help on how to use this logic inside the "Data=> " part, please take a look at the code I included here, right where I commented its where I need to include the logic to make this work:

my $msg = MIME::Lite->new( From => 'Report', To => $emails, Subject => "Num: 1", Type => 'multipart/related') or die "Error Creating Message +: $!\n"; $msg->attach( Type => 'text/html', Data => qq| <table width="760" border="1" cellspacing="0" cellpadding="0" bgcolor= +"#ffffff"> <tr> <td width="760"colspan="2" height="35" bgcolor="#ffc6a5"><b>Report + Received:</b></td> </tr> <tr><td colspan=2>&nbsp;</td></tr> <tr> <td width="100" height="">Name:</td> <td width="">$name</td> </tr> <tr> <td width="100" height="">Email:</td> <td width="">$email</td> </tr> <tr> <td colspan=\"2\" width="100%"> <table width="760" border="1" cellspacing="0" cellpadding="0" bgco +lor="#ffffff"> <tr> <td width="760"colspan="7" height="35" bgcolor="#ffc6a5"><b> +Form:</b></td> </tr> <tr><td colspan="6">&nbsp;</td></tr> <tr> <td>NAME:</td> <td colspan="6">$user</td> </tr> <tr><td colspan="6">&nbsp;</td></tr> <tr> <td width="" height="">Number:</td> <td width="" height="">Menu:</td> <td width="" height="">Description:</td> <td width="" height="">ID1:</td> <td width="" height="">ID2:</td> <td width="" height="">Deliver:</td> </tr> # I must have this logic here to have this working $alt_color=0; $c=-1; foreach (@system_names){ $c++; $color1="#f3f3f3"; $color2="#a1a1a1"; $rowcolor = $alt_color++%2 ? $color1:$color2; my $out = " <tr bgcolor=\"$rowcolor\"> <td width=\"\">$system_names[$c]</td> <td width=\"\">$name_names[$c]</td> <td width=\"\">$menu_names[$c]</td> <td width=\"\">$option_names[$c]</td> <td width=\"\">$system_names[$c]</td> <td width=\"\">Received</td> </tr> "; } # end logic </table> </td> </tr> <tr><td colspan=2>&nbsp;</td></tr> <tr> <td colspan="2" height="30" bgcolor="#46575f" align="left" valign= +"middle"> <font size="2" color="#ffffff"><b>Note: Do not reply.</b></font>&n +bsp; </td> </tr> </table> |, ); # Attach GIF image $msg->attach( Type => 'image/gif', Id => 'logo_black', Encoding => 'base64', Path => 'images/logo.gif'); $msg->send();

Thanks you for the Help!!!

In reply to HTML Email Help! by Anonymous Monk

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.