Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

trying to attach with MIME::Lite

by csorensen (Beadle)
on Jul 01, 2000 at 02:09 UTC ( #20685=perlquestion: print w/ replies, xml ) Need Help??
csorensen has asked for the wisdom of the Perl Monks concerning the following question:

I think that I've narrowed the problematic code down to these snippets
$path = ''; $new_message = MIME::Lite->new( From =>'info@constellar.com', To =>"$receiver", Subject =>'Whitepaper request', Type =>'multipart/mixed' ); $new_message->attach(Type =>'BINARY', Path =>"$path", Filename =>"$file" ); $new_message->send;
The script runs fine when I comment out the $new_message->attach block ..
either the $path or one of the Type's is wrong ... I think .. any ideas ?

Comment on trying to attach with MIME::Lite
Download Code
(jcwren) Re: trying to attach with MIME::Lite
by jcwren (Prior) on Jul 01, 2000 at 03:38 UTC
    I think possibly you're misinterpeting what the path and file parameters are. path is the path/name of the file on the system you're sending from. file is the name that you want the receiver to see it as.

    In the example below (your code, with the addition of "use strict;" and -w), the name of the Perl executable is test.pl. When I run this code, I receive the e-mail with the filename of the attachment as newname.pl. Try this code on your system (changing the names of the receiver, of course), and see if it works for you.

    (Basically, the program (test.pl) sends itself to the receiver (receiver@linux.private.com), encoded as a binary attachment (named newname.pl), from sender@linux.private.com.)
    #!/usr/local/bin/perl -w use strict; use MIME::Lite; { my $path = 'test.pl'; my $file = 'newname.pl'; my $receiver = 'receiver@linux.private.com'; my $new_message = MIME::Lite->new( From =>'sender@linux.private.com', To =>"$receiver", Subject =>'Whitepaper request', Type =>'multipart/mixed'); $new_message->attach( Type =>'BINARY', Path =>"$path", Filename =>"$file"); $new_message->send; }
    --Chris
Re: trying to attach with MIME::Lite
by csorensen (Beadle) on Jul 01, 2000 at 07:26 UTC
    ack - you're right .. thanks .. I thought the path param meant literal path

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-09-19 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls