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

Does anyone know how to attach a file using Mail::Bulkmail?
Thanks.

Replies are listed 'Best First'.
Re: Attach a file using Mail::Bulkmail
by gav^ (Curate) on May 02, 2002 at 18:57 UTC
    Create the message using MIME::Lite or similar:
    my $msg = MIME::Lite->new(..options..); $msg->attach(..file..); my $msg_mime = $msg->as_string;
    You probably don't want to do this with big files, as it's all in memory. Then send this with Mail::Bulkmail:
    my $bulk = Mail::Bulkmail->new(..options..); $bulk->HFM(1); # Headers From Message # send as usual
    Hope this helps...

    gav^

      this thread is absolutely excelent i'd like to thank all who contributed to it. i looked all day for this. altough HFM may be kind of old , currently it's called header_from_messages();

Re: Attach a file using Mail::Bulkmail
by adamcrussell (Hermit) on May 02, 2002 at 16:58 UTC

    From the documantation for Mail::Bulkmail:

    What about multipart messages? (MIME attachments) *grumble grumble* This is forthcoming, but it won't be in before version 2.5. Maybe 3.0... My current employer absolutely needs a mailing system that can handle attachments, so I figure I might as well finally get around to building it into the module. In the mean time, you can set your own headers, boundaries, etc. and just do the MIME encoding yourself. It will work, I just won't do it for you.

    So , bottom line, run your attachment through uuencode first and then e-mail it.