Mercurial > laserkard
view megamail.pl @ 75:874a6a2c28cf laserkard
session with nick. redisigned faq page
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 29 Jun 2010 15:36:30 -0400 |
parents | 021a9ab1ed5b |
children |
line wrap: on
line source
1 use MIME::QuotedPrint;2 use MIME::Base64;3 use Mail::Sendmail 0.75; # doesn't work with v. 0.74!5 %mail = (6 from => 'rlm@mit.edu',7 to => 'rlm@mit.edu',8 subject => 'Test attachment',9 );12 $boundary = "====" . time() . "====";13 $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\"";15 $message = encode_qp( "email from your friend PERL." );17 $file = "./inkscape/arrow.svg";19 open (F, $file) or die "Cannot read $file: $!";20 binmode F; undef $/;21 $attach1 = encode_base64(<F>);22 close F;26 $attach2 = encode_base64("hi this is a test arttacghjkalsdlasndlashdlsf");32 $boundary = '--'.$boundary;33 $mail{body} = <<END_OF_BODY;34 $boundary35 Content-Type: text/plain; charset="iso-8859-1"36 Content-Transfer-Encoding: quoted-printable38 $message39 $boundary40 Content-Type: application/octet-stream; name="test.svg"41 Content-Transfer-Encoding: base6442 Content-Disposition: attachment; filename="test.svg"44 $attach146 $boundary47 Content-Type: application/octet-stream; name="huh.txt"48 Content-Transfer-Encoding: base6449 Content-Disposition: attachment; filename="huh.txt"51 $attach252 $boundary--54 END_OF_BODY56 sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";