> I have a system that generates PDFs, and I want to mail them back the
> user (whose name I have access to in the script). Currently I am just
> sending a mail to them with a link to the location of the file.
>
> Does anybody know how I would accomlish this ? I have messed around with
> the mailto command, and I think I even got it to send a PDF when in
> interactive mode, but that will not do.
>
> I also tried :
> $ echo "Your PDF is ready\n~*\n ..etc" | mailto <user> -s '<subject>'
>
> Anyone know how to do this ?
>
> Regards,
> Buchan
sendmail / postfix / qmail are mail transfer agents (MTA).
You need a mail user agent (MUA) like pine, mutt, netscape, etc.
Otherwise you need to talk directly to the smtp port.
Write a perl script using the MIME::Lite package.
To see if you have MIME::Lite, see what happens with...
~--> perldoc -l MIME::Litt
No documentation found for "MIME::Litt".
~--> perldoc -l MIME::Lite
/usr/lib/perl5/site_perl/5.6.0/MIME/Lite.pm
To get that Perl module, add this
alias cpan='perl -MCPAN -e shell'
to your ~/.bashrc file (and do: . ~/.bashrc). Now type 'cpan',
and at the cpan > prompt, enter
install MIME::Lite
If this is the first time, you will have to configure Bundle::CPAN
Here's a test example...
###########################################################################
#! /usr/bin/perl -w
#
# mail_smtp.pl
use MIME::Lite;
# MIME::Lite->quiet();
# MIME::Lite->send('sendmail', '/usr/lib/sendmail -t -oi -oem'); #default
MIME::Lite->send('smtp', 'smtp.myisp.com', Timeout=>60);
# Create a new multipart message:
$msg = new MIME::Lite
From =>'[EMAIL PROTECTED]',
To =>'"Dan Woods" <[EMAIL PROTECTED]>',
Subject =>'multipart testing',
'X-Mailer' =>'4loops.com 1.0',
Organization =>'4Loops Internet Services',
'Reply-To' =>'[EMAIL PROTECTED]',
Type =>'multipart/mixed';
$msg->attr("content-type.charset" => "iso-8859-1");
# Add parts (each "attach" has same arguments as "new"):
attach $msg
Type =>'TEXT',
Data =>"Here's the newest archive:";
attach $msg
# Encoding =>'quoted-printable',
Type =>'text/plain',
Disposition =>'attachment',
Path =>'4loopsFiles.cgi';
attach $msg
Encoding =>'base64',
Type =>'image/gif',
Path =>'../public_html/popc.gif',
Filename =>'popc.gif';
attach $msg
Encoding =>'base64',
Type =>'application/pdf',
Path =>'../public_html/Downcoding.pdf',
ReadNow => 0,
Filename =>'Downcoding.pdf';
# attach $msg
# Encoding =>'base64',
# # Type =>'BINARY',
# # Type =>'application/octet-stream',
# Type =>'application/msword',
# Path =>'../public_html/Downcoding.doc',
# ReadNow => 0,
# Filename =>'Downcoding.doc';
# Send the message:
# Send in the "best" way (the default is to use "sendmail"):
$msg->send || die "Mail not sent!";
# end of script mail_archive.pl
###########################################################################
Thanks... Dan.
Keep in touch with http://mandrakeforum.com:
Subscribe the "[EMAIL PROTECTED]" mailing list.