How to Send an Email From a Linux Command Line
- 1). Type the command "mail" into the console and hit the spacebar. When you hit "enter" at the end of the command, the console will read your input as a command to send an email.
- 2). Type "-s" and hit the spacebar. The "-s" indicates that the next argument in the command will be the email's subject. Type your subject and press the spacebar. If your subject contains more than one word, enclose the phrase in quotation marks to indicate it is one argument, otherwise the console will throw an error when the command is executed.
- 3). Type the email address you want to send the email to and hit "enter." If you want to send the email to more than one email address, you will enter the other addresses later.
- 4). Type the message you wish to send into the console and hit "enter." Press "Control+D" to prepare your message for sending. If you want to send the email to additional email addresses, type them into the prompt.
- 5). Press "Control+D" to send your email.
- 1). Type the command "mail" into the console and hit the spacebar. Type "-s" followed by a space and enter the subject of your email. Press the spacebar again.
- 2). Type the first email address that you want to receive your email. Hit the spacebar.
- 3). Type "-c" to carbon copy the email to an address or list of addresses. If you want to CC more than one email address, type a comma and a space after each email address in the CC list.
- 4). Type "-b" to blind carbon copy the email to an address or list of addresses. If you want to BCC more than one email address, type a comma and a space after each email address in the BCC list.
- 5). Type "< " followed by the path to a text file to send the contents of the file as the text of your email message. If your file was called "MyMessage.txt" and was stored in the "/home" directory, you would type "< /home/MyMessage.txt" to send the contents of the file as your email.
Using the Mail Command
Advanced Use of the Mail Command
Source...