Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

MIME::Lite - For outging mail with attachments

by trs80 (Priest)
on Jan 19, 2002 at 02:00 UTC ( #139965=modulereview: print w/ replies, xml ) Need Help??

Item Description: Builds MIME structures

Review Synopsis:

I first came across MIME::Lite about 2 years ago when working on an online mail system. We had some in house code that we had been using to create outgoing messages, but it was ugly and brittle.

MIME::Lite in a Nutshell

### Create a new multipart message: $msg = MIME::Lite->new( From =>'me@myhost.com', To =>'you@yourhost.com', Cc =>'some@other.com, some@more.com', Subject =>'A message with 2 parts...', Type =>'multipart/mixed' ); ### Add parts (each "attach" has same arguments as "new"): $msg->attach(Type =>'TEXT', Data =>"Here's the GIF file you wanted" ); $msg->attach(Type =>'image/gif', Path =>'aaa000123.gif', Filename =>'logo.gif', Disposition => 'attachment' );
Output a message:
### Format as a string: $str = $msg->as_string; ### Print to a filehandle (say, a "sendmail" stream): $msg->print(\*SENDMAIL);
Send a message:
### Send in the "best" way (the default is to use "sendmail"): $msg->send;
MIME::Lite supports several methods to send the message via SMTP.

If you need to create a valid email with attachments then MIME::Lite is one of the easiest most mature modules I have found. Easy because you don't need to know much about RFC822 to use it. The public interface that it offers is well thought out and provides access to almost every aspect of the class. That is also why I feel it is a very mature module. As of this write up it is on version 2.117. The author of this module is also the author of MIME-tools. The interface for MIME::Lite is much easier for the end user then that of MIME-tools in my opinion. MIME-tools have a steep learning curve if you are new to Perl. Regardless the authors understanding of the MIME proctocol is much more indepth then most people will need and MIME::Lite provides a simpe way to build outgoing mail messages.

MIME-tools Review
MIME::Lite documentation

Comment on MIME::Lite - For outging mail with attachments
Select or Download Code
Re: MIME::Lite
by gav^ (Curate) on Jan 19, 2002 at 04:41 UTC
    I've found that calling $msg->scrub does wonders for some email clients.

    Hope this helps...

    gav^

      I didn't really mention it because the version I have still claims it is Alpha code (scrub that is). I don't want to promote something that isn't well tested. Could you expand your comment so others can learn from your exprience with it?
        I have only tested it sending a mime message with html/text alternatives. We generally test stuff on outlook/outlook express, eudora, pegasus, hotmail and AOL. Using scrub gave better results, i.e. the message was displayed correctly. A lot of these clients are very broke when it comes to MIME. I'll try to put together some kind of test suite and give you some better information.

        gav^

Re: MIME::Lite
by impossiblerobot (Deacon) on Jan 19, 2002 at 21:53 UTC
    Although I admire trs80 for trying, this wasn't really a review. More information is available in the POD.

    It might have been nice to show a variety of MIME-related tasks that the module makes easier. Even some factual information that would back up generic claims like "long feature list" and "mature" would help.

    If the module and its documentation are self-explanatory, and nothing can be added, there's probably no need for a review. :-)

    Impossible Robot
      Thanks Impossible Robot!
      I went back over my initial post and I am modifing it to
      include some of your suggestions.

      I think some people might look only under Mail instead of MIME,
      if they have a limited knowledge of the actual protocol
      involved. So I was hoping a short plug for what this module
      does without all the noise of the documentation might be
      helpful.

      Any other suggestions?
        this wasn't really a review

      Maybe it would be better to call it a quickstart tutorial or something.   Even if it doesn't fit perfectly in any category, it will be useful to find in a SuperSearch on MIME.

      (And, yes, trs80 a longer title along the lines of "MIME::Lite (for mail attachments)" might help those most in need find it most easily.)

        p

      > If the module and its documentation are self-explanatory, and nothing can be added, there's probably no need for a review. :-)

      Well ... not really. The fact that someone took the time to review the module and write about it here means that the module is (most probably) worth looking at. Plus it may help people find the module. MIME::Lite is a great example of this. Who would consider looking under MIME if all he wants is to send a mail with attachments?

      Jenda

      P.S.: It's a shame noone wrote a review of MIME::Lite's rival, Mail::Sender. :-(
      I can't do that myself, can I? ;-)

Back to Reviews

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: modulereview [id://139965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-12-22 02:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls