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

Hi Monks, I am looking for some help on how to send mail with attachement using Perl. All your help would be appreciated. Thanks

Replies are listed 'Best First'.
Re: Sending mail with attachment in Perl
by hsinclai (Deacon) on Oct 16, 2004 at 17:07 UTC
      I am using MIME::Lite but I get this error. "Can't locate MIME/Lite.pm in @INC"
        Then you should install it, no? Alternatively, if you already have it installed but in a non-standard directory, you should do a "use lib '/somepath';".
Re: Sending mail with attachment in Perl
by gothic_mallard (Pilgrim) on Oct 16, 2004 at 17:28 UTC

    A while back I wrote a quick object-orientated email module that may be helpful. It simplifies the whole email system and makes it easy to send email in plain or html formats with or without attachments.

    You can find it here.

    The most recent version should also be available at my website (at time of writing the hosting was down for maintanence but should be up again soon!).

    --- Jay

    All code is untested unless otherwise stated.

Re: Sending mail with attachment in Perl
by jordanh (Chaplain) on Oct 16, 2004 at 20:25 UTC
Re: Sending mail with attachment in Perl
by data64 (Chaplain) on Oct 17, 2004 at 01:34 UTC
Re: Sending mail with attachment in Perl
by true (Pilgrim) on Oct 17, 2004 at 23:56 UTC
    FYI here only, The thing that makes an attachment in an email is a MIME header. All you are doing is dividing your text message into different parts via boundaries. You set a boundary and use it to delimit the parts of your mail message. MIME headers follow their own set of rules. Example, two \n's specify a seperation between the head and body. MIME types are diverse and give you a number of options for nesting binary data into your email. All mail messages have content-type headers just like html pages. So a message with an attached picture would be a mixed content type. Boundaries specify where the parts are and each seperate part can also have its own content-type headers.

    Obviously, a module is the fastest was to work with MIME, but if you need to go deeper the above is just a nutshell.

    jtrue