Micheal Patterson micheal at
Wed Dec 31 14:35:04 PST 2003

----- Original Message ----- 
From: "Chad Albert" <Chad.Albert at>
To: <freebsd-questions at>
Sent: Wednesday, December 31, 2003 3:46 PM
Subject: mail

> I am writing a script that mails me when certain events occur.  I am
> using mail(1) to notify me by email when some things happen.  I have
> read the man page and I don't see a way to attach a file, does anyone
> know how to use mail(1) to attach a file?

If it's a text file, just cat filename.ext |mail -s "subject" sender at address
to send the contents to the target address. On the other hand, if you want
to attach the file, use mailx from ports. There's an -a flag to attach files
to outbound emails.


Micheal Patterson
TSG Network Administration

Confidentiality Notice:  This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of the original

More information about the freebsd-questions mailing list