Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 2004 09:47:45 +0200
From:      Nelis Lamprecht <nelis@8ball.co.za>
To:        Murray Taylor <murraytaylor@bytecraftsystems.com>
Cc:        Murray Taylor <taylorm@bytecraft.au.com>
Subject:   Re: How to send attached files on sendmail with mail tool?
Message-ID:  <1090568822.31569.26.camel@nelis.brabys.co.za>
In-Reply-To: <1090562873.349.22.camel@wstaylorm.dand06.au.bytecraft.au.com>
References:  <200407162036.i6GKaNt11099@www.plutao.lusodigital.net> <200407202324.30211.jaymo@cromagnon.cullmail.com> <20040721090847.F85700@chylonia.3miasto.net> <200407230057.06978.jaymo@cromagnon.cullmail.com> <1090562873.349.22.camel@wstaylorm.dand06.au.bytecraft.au.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-yNt3I9vIDi1+wIfDOr4p
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Fri, 2004-07-23 at 08:07, Murray Taylor wrote:

> This works with winblows  - I use it in production here
>=20
> cat file | uuencode tgt_filname | mail -s "subject" test@example.com
>       ^                 ^
>       |                 +--- attachment FILENAME for the target host to
> use
>       +--- attachment CONTENT from the source host
>=20

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;
=20
$to      =3D $ARGV [0];
$replyto =3D "someone\@domain.com";
$subject =3D $ARGV [1];
$file    =3D $ARGV [2];
$mesg    =3D $ARGV [3];
$from    =3D "someone\@domain.com";
=20
if (! $file )
{
        PrintUsage();
        die "\n";
}
=20
else
{
=20
$sender =3D new Mail::Sender
 {smtp =3D> 'your.smtp.server.ip', from =3D> $from};
=20
$sender->MailFile({ to      =3D> $to,
                    replyto =3D> $replyto,
                    subject =3D> $subject,
                    msg     =3D> $mesg,
                    file    =3D> $file});
=20
print "The file $file has been sent to $to\n";
};
=20
sub PrintUsage
{
        print "Usage: mailfile.pl <To> <Subject> <File> <Message>";

};

Not tested but should work, just alter to suit your needs.

Regards,
--=20
Nelis Lamprecht
PGP: http://www.8ball.co.za/pgpkey/nelis.asc
"Unix IS user friendly.. It's just selective about who its friends are."

--=-yNt3I9vIDi1+wIfDOr4p
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBBAMJ2QfIMKiRMCrERAuUqAKCuIuPymvijEBtdXcZ9iyIQLgYyEwCg5ju3
hgowQnxvv0aG+Q/imVLP2AE=
=pxwj
-----END PGP SIGNATURE-----

--=-yNt3I9vIDi1+wIfDOr4p--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1090568822.31569.26.camel>