Im still new to Perl too but I know that to send email formatted in HTML is quite simple. I am not familiar with the module stated but I would like to go lower level than that. First, its all about the MUA (mail user agent or email client) and how it will interpret your email message. There of course are standards out there that make your MUA do what you want it to do. Thus, there are extension headers you can place in your emails that the MUA interprets. If you want to set your message priority you do that using the X-Priority header. If you want to do HTML, you set the Mime-version and your Content-type. There are many other things you can set that your MUA will interpret and others that it will ignore but that can be seen for informational purposes. Here are a few:
X-Mailer: MSN Explorer 6.00.0010.0912 X-OriginalArrivalTime: 23 Mar 2001 23:59:19.0685 (UTC) FILETIME=[4675A +B50:01C0B3F5] X-UIDL: 281293976 <-- set by the POP server
I like to test things via command line before doing them in a script though. So, what I did to test this out was I actually sent a message out via command line.
[ notjamesnjkwan ~ ] $ cat << msg | sendmail jconner@fake_domain.com > Mime-Version: 1.1 > Content-type: text/html > Subject: This is a test for html > <font color=blue>Line in blue</font><br> > <font color=red>Line in red</font> > . > msg
With sendmail you can basicly write some of your own headers which is what I did. After the headers were properly written for the MUA to interpret the HTML, I simply write the html. Thats it. In perl it should be the same way:
open(PIPE,"| /usr/lib/sendmail $RCPT"); print PIPE "Mime-Version: 1.1\r\nContent-type: text/html\r\n"; print PIPE "Subject: $SUBJECT\r\n"; print PIPE "message here with HTML embedded\r\n.\r\n"; close(PIPE);
I haven't actually tried the \r\n's in a single line yet but I see no reason why they shouldn't work :)

- Jim


In reply to Re: Re: Still New to Perl / html email by snafu
in thread Still New to Perl / html email by esolm

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.