We can attach documents, images, text files, etc. $ mail - s "A mail sent using mailx" -c -b Adding AttachmentsĪttachments are a vital part of email communication. For CC, we use the “-c” option & for BCC we use the “-b” option which is followed by the email addresses. We can send a carbon copy (CC) or a blind carbon copy (BCC) to send the same email to multiple recipients (visibly or in a hidden manner). Using pipes $ echo "Example Message" | mail - s "A mail sent using mailx" Sending same Mail to Multiple Recipients: We can send the same email to multiple receivers (not by cc or bcc) as follows: $ mail - s "A mail sent using mailx" < /path/to/file Taking the message from a file $ mail -s "A mail sent using mailx" < /path/to/fileģ.
$ mail -s "A mail sent using mailx" person,Ģ. After the content is written, press Ctrl+D & EOT will be displayed by mailx. After this, mailx waits for the content of the email. 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. Note: Even though the mailx command is a newer version of the original mail utility, it can still be referenced with the ‘mail’ keyword.ġ. The mailx command is available from a variety of different packages:įor Ubuntu/Debian: sudo apt-get install bsd-mailx Along with the functionality provided by the original mail command, it provides extra features like the ability to send attachments by using the -a flag. The mailx utility is an enhanced version of the mail command. As the name suggests, it is a console application that is used for sending and receiving emails. Linux has an inbuilt Mail User Agent program called mailx.
Mail command in linux not working how to#