FreeBSD send mail with attachments from command line / shell prompt
Q. I need to send few reports everyday as a mail attachment. I’m using FreeBSD 6.2 server. How do I send mail from a command line or a shell script?
A. You can easily send email attachment using mutt mail client. It works from command line or a shell prompt. However mutt is not installed by default. You need to install mutt command. mutt command also works under UNIX and Linux like commands.
Install mutt under FreeBSD
Mutt is a small but very powerful text based program for reading electronic mail under unix operating systems, including support color terminals, MIME, and a threaded sorting mode.
Use pkg_add command for installing software package distributions. Type the following command to install mutt:
# pkg_add -v -r mutt
Alternatively, you can use FreeBSD ports collections:
# cd /usr/ports/mail/mutt
# make install clean
FreeBsd command line mail attach with mutt
Send reports.tar.gz file to vivek@gmail.co.in
$ mutt -s "Reports" -a reports.tar.gz vivek@gmail.co.in
OR
$ mutt -s "Subject" -a reports.tar.gz vivek@gmail.co.in < /tmp/mail-message.txt
Where,
- -a file : Attach a file to your message using MIME.
- -s subject : Specify the subject of the message.
For multiple file attachments use -a for each file:
$ mutt -s "Subject" -a file1.tar.gz -a file2.tar.gz vivek@gmail.co.in
For more information read mutt command man page.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Qmail delivering mail ~/Mailbox home directories
- Email multiple file attachment from Solairs / AIX / HP-UX UNIX/ Linux command line
- Linux and UNIX Mail Command to send and receive mail
- Force sendmail to route mail to specific hosts or mailserver
- Sending mail with Perl mail script
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: electronic_mail, email_attachment, installing_software, mail_attachment, mail_client, mutt, mutt_command, pkg_command, shell_script, software_package, unix_mail_command_line_attachments, unix_operating_systems



Recent Comments
Today ~ 1 Comment
Today ~ 3 Comments
Today ~ 57 Comments
Yesterday ~ 9 Comments
Yesterday ~ 7 Comments