Sending mail from the Linux command line is useful for system administrators who can attach backup files, log files/system run reports, or any relevant information, and send it to remote computers. Requirements This article uses the Centos7 operating system.

You need to have a working mail system. This article does not cover how to configure a mail server.

Install the Mailx installation package using the Mail command

[root@localhost ~]# yum -y install mailx, we can use the following to send mail with attachments:

/ root @ localhost ~ # echo “Message Body Here” | mail -s “Subject Here” [email protected] – a anaconda – ks. CFG the -s: specify the email Subject. – A: Add attachments. You can also save the message content in a file and then send it using Mail:

[root@localhost ~]# mail-s “Subject here” -t ad-a anaconda-ks.cfg < message.txt

[root@localhost ~]# yum -y install mutt: [root@localhost ~]# yum -y install mutt: # yum -y install mutt:

[root @ localhost ~] # echo “Message Body Here” | mutt -s “Subject Here” – a anaconda – ks. CFG: [email protected] the – s specified email Subject. – A: Add attachments.

Summary Is there any other way you can send email with attachments from a Linux terminal?