12/28/2022 0 Comments Mail command in linux with attachment![]() ![]() Thatâs all! Do you have in mind any other methods of sending emails with attachment from the Linux terminal, that are not mentioned in the list above? Let us know in the comments. To send a message with attachment, run the command below. 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. $ echo "Message Body Here" | mailx -s "Subject Here" -a backup.zip 4. Now send the attachment mail from the command-line using mailx command. Mailx works more like the mutt command and it it also a part of mailutils (On Debian) package. Read more about Mutt â A Command Line Email Client to Send Mails from Terminal 3. $ echo "Message Body Here" | mutt -s "Subject Here" -a backup.zip You can send an email with attachment using the mutt command below. mailx command by default opens the current userâs system mailbox (/var/mail/), so just Open the Unix/Linux terminal and type mailxwithout any parameters on the command prompt to read emails.If you do not have it on your system, type the command below to install it: $ sudo apt-get install mutt All the examples mentioned below are tested with GNU mailx on Ubuntu 18.04 and Ubuntu 20.04 Linux Distro. Mutt is a popular, lightweight command line email client for Linux. You can as well send an existing message from a file as follows: $ mail -s "Subject here" -t -A backup.zip < message.txt $ echo "Message Body Here" | mail -s "Subject Here" -A backup.zip Now its time to send an email attachment using mail command a shown. ![]() Mail is part of the mailutils (On Debian) and mailx (On RedHat) package and it is used to process messages on the command line. Below are the various, well known methods of sending email with attachment from the terminal. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |