How to send attached files on sendmail with mail tool?
Nelis Lamprecht
nelis at 8ball.co.za
Fri Jul 23 00:47:53 PDT 2004
On Fri, 2004-07-23 at 08:07, Murray Taylor wrote:
> This works with winblows - I use it in production here
>
> cat file | uuencode tgt_filname | mail -s "subject" test at example.com
> ^ ^
> | +--- attachment FILENAME for the target host to
> use
> +--- attachment CONTENT from the source host
>
May I suggest an alternative - /usr/ports/mail/p5-Mail-Sender
Install this perl module and then you can easily write a simple script
to handle your attachments. Something like the following:
#!/usr/local/bin/perl -w
use Mail::Sender;
$to = $ARGV [0];
$replyto = "someone\@domain.com";
$subject = $ARGV [1];
$file = $ARGV [2];
$mesg = $ARGV [3];
$from = "someone\@domain.com";
if (! $file )
{
PrintUsage();
die "\n";
}
else
{
$sender = new Mail::Sender
{smtp => 'your.smtp.server.ip', from => $from};
$sender->MailFile({ to => $to,
replyto => $replyto,
subject => $subject,
msg => $mesg,
file => $file});
print "The file $file has been sent to $to\n";
};
sub PrintUsage
{
print "Usage: mailfile.pl <To> <Subject> <File> <Message>";
};
Not tested but should work, just alter to suit your needs.
Regards,
--
Nelis Lamprecht
PGP: http://www.8ball.co.za/pgpkey/nelis.asc
"Unix IS user friendly.. It's just selective about who its friends are."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040723/b3a83ee4/attachment.bin
More information about the freebsd-questions
mailing list