Gossamer Forum
Home : General : Perl Programming :

Re: Email attachments

Quote Reply
Re: Email attachments In reply to
There are lots of scripts around that do this and I have written one myself that will email a file that is uploaded from a form or fetched using Net::FTP

I use

use MIME::Base64 qw(encode_base64);

in my script to encode the attatchent. This is supposed to be around 24 times faster than encoding with the perl encode sub.

You then need to send the content type in the header and define the boundary...

my @boundaryv = (0..9, 'A'..'F');
srand(time ^ $$);
for (my $i = 0; $i < 24;) {
$boundary .= $boundaryv[rand(@boundaryv)];
}

Then define Content-Transfer-Encoding and Content-Disposition.

Then encode the attatchment and send.



Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Subject Author Views Date
Thread Email attachments Endor 4855 Apr 16, 2001, 1:39 PM
Thread Re: Email attachments
Paul 4736 Apr 16, 2001, 2:21 PM
Thread Re: Email attachments
Endor 4687 May 27, 2001, 12:16 PM
Thread Re: Email attachments
Paul 4684 May 27, 2001, 1:14 PM
Thread Re: Email attachments
Endor 4668 May 27, 2001, 4:55 PM
Thread Re: Email attachments
Paul 4680 May 27, 2001, 5:00 PM
Thread Re: Email attachments
Chef 4633 Jun 3, 2001, 7:23 AM
Post Re: Email attachments
Paul 4639 Jun 3, 2001, 7:58 AM