

In this example we will send email both to the and. $ cat body.txt | mail -s "Hello World" Set Multiple RecipientĪnother useful feature of mail command is providing multiple recipients by simply delimiting recipients emails. There is other way to send mail by redirecting body content with pipe like below.
#Using the mail command in linux how to
How are you? I hope your pageviews are good.Īnd we send $ mail -s "Hello World" < body.txt How to use diff command in linux - The diff command analyzes line by line and displays a list of changes between two files. In this example body.txt file contains body part of the mail. Body part can be read from a file by simply redirecting the content to the mail command like below. But if it is long and repetitive task we do not want to do always there is an alternative. While sending email there will be body part of the mail.
#Using the mail command in linux install
In order to work properly we should install the bsd-mailx package like below. Linux distributions provides two mailx command one from the mailutils package which is installed by default and the other one is from the bsd-mailx package.

Mail Client Sender -> MTA of sender -> MTA receiver -> Mail Client Receiver Install mailx Command In this tutorial, you'll learn how locate command works and how to use it. there are some protocol used to accomplish these tasks like smtp,pop3,imap etc.īelow are some architectural view of a simple email transmission. The locate command allows you to preform a super quick search for files. Mail Transfer Agent (MTA) is an intermedia component used to receive, send, store mail messages.It only supports reading mail locally on a unix server, typically stored in mbox format in /var/mail or a similar location. Mail clients connects to the mail transfer agent to transmit emails. The mail command is an old and primitive mail client. Mail Client is an application used by user directly to send and get emails.There are some terms we should learn before continue General ConceptĪs stated in previous paragraph email systems are bit more complex than standard client server architecture. It is based on Berkeley Mail 8.1, is intended to provide the functionality of the mail command, and offers extensions for MIME, IMAP, POP3, SMTP, and S/MIME. After the content is written, press Ctrl+D & EOT will be displayed by mailx. After this, mailx waits for the content of the email. mailx command supports the MIME, IMAP, POP3, SMTP, and S/MIME protocols and based Berkeley Mail 8.1 mail command. mailx is an intelligent mail processing system, which has a command syntax reminiscent of ed with lines replaced by messages. Writing the message directly in the command line: To send a simple email, use the -s flag to set the subject in quotes which is followed by the email of the receiver. mailx more advanced version of the mail tool. We will look at a command-line based mailing application named mailx. An email has a different architecture than standard client-server. Linux has a lot of tools, services, and applications related to email.
