Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Using MIME-Lite to send attachment

by rscott212 (Sexton)
on Apr 02, 2004 at 15:39 UTC ( [id://342005]=perlquestion: print w/replies, xml ) Need Help??

rscott212 has asked for the wisdom of the Perl Monks concerning the following question:

I tried to use the following code to use mime lite module to send an attachement and got the following error! What am I doing wrong? Do I need to move the module into a different directory?

Can't locate MIME/Lite.pm in @INC (@INC contains: D:/Perl/lib D:/Perl/site/lib .) at C:\A\backup\scripts\mail_attach.pl line 2.

Below is my code!

use MIME::Lite; ### Create a new multipart message: $msg = MIME::Lite->new( From =>'johns@mindspring.com', To =>'peter21458@aol.com', #Cc =>'some@other.com, some@more.com', Subject =>'A test with attachment', Type =>'multipart/mixed' ); ### Add parts (each "attach" has same arguments as "new"): $msg->attach(Type =>'TEXT', Data =>"Here's the file you wanted" ); $msg->attach(Type =>'image/gif', Path =>'C:\a\backup\cursors', Filename =>'butterfly.ani' ); $text = $msg->as_string;

20040403 Edit by castaway: Changed title from 'Using MIM-Lite to send attachment'

Replies are listed 'Best First'.
Re: Using MIME-Lite to send attachment
by tachyon (Chancellor) on Apr 02, 2004 at 16:05 UTC

    As noted you need to install the module. It is probably not installed. The error message is the error message you get when a module can't be found. See A Guide to Installing Modules or if you are lazy try this at the command prompt:

    ppm install Mime::Lite

    The next problem you will probably have is the lack of an MTA to send the mail as you are unlikely to have sendmail. Read the most excellent Mime::Lite docs - especially the send_by_smtp() method part.

    cheers

    tachyon

      Thanks. Since I'm blind, it's sometimes difficult to read (or get my screenreader to read) documentation and/or code. This site is especially difficult with all the frames, but I get quick and great solutions to problems here! Rob

        Ah blind. Your view of the site will therefore be far different to what I and most others see. I have but the vaguest understanding of how potentially confusing a framed site must be.

        On the practical side I would suggest you perhaps include that somewhat relevant fact in your signature. The reason is not to evoke sympathy but simply to make the monks aware that what seems like a simple task available using tried and true RTFM techniques is not as easy for some people as others.

        You can make the site considerably more 'reader' friendly by simplifying it. By simplify I mean get rid of the frames. To do this go to your home node. If you have not been to your home node before all you need to do is click on your login handle or search for it.

        Now at the 'bottom' of what is the main content you will find a link with text User Settings. The link appears in the form 'Change your *user settings*'. Click on that link. On the page that renders you will have near the 'top' a link 'To configure your nodelets, see *Nodelet Settings*'. Nodelet Settings is the link text. Click on that link. Now select 'all nodelets off' checkbox and submit.

        All frames except the iframe that contains the banner ad for the site will now be gone. The only thing you may miss is the chatterbox and messages back to you. There are stand alone clients for that part anyway.

        So welcome to the Monestary. I hope that makes it a little easier for you to find your way around.

        PS: Should you choose to add a signature you will find a text box on the user settings page as well. It is called 'setsignature'.

        PPS: Perlmonks is in a way unique in that a significant number of the users hack code for the site. If there are things that you can see here for which the sighted are blind they would make for interesting meditations and perhaps lead to the site becoming more friendly to the visually impaired. If you are partially sighted as opposed to completely blind you also have the ability using stylesheets to dramatically change the way the site renders. As always YMMV.

        cheers

        tachyon

Re: Using MIME-Lite to send attachment
by esskar (Deacon) on Apr 02, 2004 at 15:52 UTC
    you have to install the module first.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://342005]
Approved by Corion
Front-paged by Paulster2
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-20 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found