Once you get familiar with using the Linux terminal, you would like to try and do everything on your system by merely writing commands together with sending emails and one in all the vital aspects of the send email attachment.
In this post, we’ll learn the ways to send email attachment from the Linux terminal. significantly, there are many statement email shoppers for Linux that you just will use to method emails with easy options.
MTA is an application to blame for causation and receiving emails from one host to a different. you want to have an operating mail system or set up one of the mail transfer agents (MTA’s) for Linux on your system. we can use the following four (4) commands for sending mail with attachments.
Using mail Command
Mail is part of the mailutils (On Debian) and mailx (On RedHat) package and it is used to process messages on the command line.
1 2 3 4 5 6 7 8 9 10 11 12 |
$ sudo apt-get install mailutils # yum install mailx # Now it’s time to send an email attachment using mail command a shown. $ echo "Message Body Here" | mail -s "Subject Here" support@techaid24.com -A backup.zip # In the above command, the flag: # 1. -s – specifies the message subject. # 2. -A – helps to attach a file. # You can as well send an existing message from a file as follows: $ mail -s "Subject here" -t support@techaid24.com -A backup.zip < message.txt |
Using mutt Command
mutt is a popular, lightweight command-line email client for Linux. If you do not have it on your system, type the command below to install it:
1 2 3 4 5 6 7 8 9 10 |
$ sudo apt-get install mutt # yum install mutt # You can send an email with attachment using the mutt command below. $ echo "Message Body Here" | mutt -s "Subject Here" -a backup.zip support@techaid24.com # where the option: # 1. -s – indicates the message subject. # 2. -a – identifies the attachment(s). |
Using mailx Command
mailx works more like the mutt command and is also a part of mailutils (On Debian) package.
1 2 3 4 5 6 |
$ sudo apt-get install mailutils # yum install mailx # Now send the attachment mail from the command-line using mailx command. $ echo "Message Body Here" | mailx -s "Subject Here" -a backup.zip support@techaid24.com |
Using mpack Command
mpack encodes the named file in one or more MIME messages and sends the message to one or more recipients, or writes it to a named file or set of files, or posts it to a set of newsgroups.
1 2 3 4 5 6 |
$ sudo apt-get install mpack # yum install mpack # To send a message with attachment, run the command below. $ mpack -s "Subject here" file support@techaid24.com |
Thanks for continues with us… You are most welcome to share your technical knowledge with all…
4 Ways to Send Email Attachment from Linux Command Line
The article was published on December 27, 2018 @ 4:46 PM
Leave a Comment