How VPS - How to use/setup VPS
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

Mutt – A Command Line Email Client to Send Mails from Terminal

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
39
VIEWS
Share on FacebookShare on Twitter

Contents

  1. What is Mutt?
  2. Mutt Features
  3. How to Install Mutt in Linux
    1. Configuration files
    2. Basic Syntax of mutt command
    3. Read Emails with Mutt
    4. Send an email with mutt command
    5. Add Carbon copy(Cc) and Blind Carbon copy(Bcc)
    6. Send Emails with Attachments
    7. Use of muttrc file
    8. Getting Help

As a System admin, sometimes we need to send mails to users or someone else from the server and for that we used to go with a web based interface to send email, is it really that handy ? Absolutely No.

Mutt – A Command Line Email Client to Send Mails from Terminal

Mutt Command Line Email Client

Here in this tutorial, we’ll be using the mutt (a terminal email client) command to send email from command line interlace.

What is Mutt?

Mutt is a command line based Email client. It’s a very useful and powerful tool to send and read mails from command line in Unix based systems. Mutt also supports POP and IMAP protocols for receiving mails. It opens with a coloured interface to send Email which makes it user friendly to send emails from command line.

Mutt Features

Some other important features of Mutt is as follows:

  1. Its very Easy to install and configure.
  2. Allows us to send emails with attachments from the command line.
  3. It also has the features to add BCC (Blind carbon copy) and CC (Carbon copy) while sending mails.
  4. It allows message threading.
  5. It provides us the facility of mailing lists.
  6. It also support so many mailbox formats like maildir, mbox, MH and MMDF.
  7. Supports at least 20 languages.
  8. It also support DSN (Delivery Status Notification).

How to Install Mutt in Linux

We can install Mutt Client in our Linux box very easily with any package installers as shown.

# apt-get install mutt (For Debian / Ubuntu based system)
# yum install mutt (For RHEL / CentOS / Fedora based system)
Configuration files

Configuration files of Mutt Email client.

  1. Main Configuration file: To make changes globally for all users For mutt, you can make changes in its mail configuration file “/etc/Muttrc“.
  2. User Configuration file of Mutt : If you want to set some specific configuration for a particular user for Mutt, you can configure those settings in ~/.muttrc or ~/.mutt/muttrc files.
Basic Syntax of mutt command
mutt options recipient
Read Emails with Mutt

To read emails of the user with you are currently logged in, you just need to run “mutt” on the terminal, it will load the current user’s mailbox.

[[email protected] ~]#  mutt
Mutt – A Command Line Email Client to Send Mails from Terminal

Read Mail from Terminal

To read the emails of a specific user, you need to specify which mail file to read. For example, You (as root) wants to read mails of user “John“, you need to specify his mail file with “-f” option with mutt command.

[[email protected] ~]#  mutt -f /var/spool/mail/john

You may also use “-R” option to open a mailbox in read-only mode.

Send an email with mutt command

In this example, following command will send a test Email to [email protected]. The “-s” option is used to specify Subject of the mail.

[[email protected] ~]#  mutt -s "Test Email" [email protected]

When you enter the above command in the terminal, it opens up with an interface and confirms the recipient address and subject of the mail and opens up the interface, here you can make changes to recipient mail address.

  1. Change recipient email address pressing t.
  2. Change Cc address with c.
  3. Attach files as attachments with a.
  4. Quit from the interface with q.
  5. Send that email by pressing y.

Note: When you press “y” it shows the status below that mutt is sending mail.

Mutt – A Command Line Email Client to Send Mails from Terminal

Send Mail from Terminal

Add Carbon copy(Cc) and Blind Carbon copy(Bcc)

We can add Cc and Bcc with mutt command to our email with “-c” and “-b” option.

[[email protected] ~]# mutt -s "Subject of mail" -c <email add for CC> -b <email-add for BCC> mail address of recipient
[[email protected] ~]# mutt -s “Test Email” -c [email protected]  -b [email protected] [email protected]

Here in this example, root is sending email to [email protected] and putting [email protected] as Cc address and [email protected] as Bcc.

Mutt &#8211; A Command Line Email Client to Send Mails from Terminal

Send Mail as CC or BCC in Terminal

Send Emails with Attachments

We can send email from command line with attachments by using “-a” option with mutt command.

[[email protected] ~]# mutt  -s "Subject of Mail" -a <path of  attachment file> -c <email address of CC>  mail address of recipient
[[email protected] ~]# mutt -s "Site Backup" -a /backups/backup.tar  -c [email protected] [email protected]
Mutt &#8211; A Command Line Email Client to Send Mails from Terminal

Send Email Attachment from Terminal

Here in above snapshot, you can see that it shows attachment attached with the mail.

Use of muttrc file

If we want to change the senders name and email, then we need to Create a file in that particular user’s home directory.

[[email protected] ~]# cat .muttrc

Add the following lines to it. Save and close it.

set from = "[email protected]"
set realname = "Realname of the user"
Getting Help

To print the help menu of “mutt”, we need to specify “-h” option with it.

[[email protected] ~]# mutt -h

Mutt 1.4.2.2i (2006-07-14)
usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]
       mutt [ -nx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ] 
       mutt [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] <addr> [ ... ]
       mutt [ -n ] [ -e <cmd> ] [ -F <file> ] -p -v[v]
options:
  -a <file>     attach a file to the message
  -b <address>  specify a blind carbon-copy (BCC) address
  -c <address>  specify a carbon-copy (CC) address
  -e <command>  specify a command to be executed after initialization
  -f <file>     specify which mailbox to read
  -F <file>     specify an alternate muttrc file
  -H <file>     specify a draft file to read header from
  -i <file>     specify a file which Mutt should include in the reply
  -m <type>     specify a default mailbox type
  -n            causes Mutt not to read the system Muttrc
  -p            recall a postponed message
  -R            mailbox in read-only mode
  -s <subj>     specify a subject (must be in quotes if it has spaces)
  -v            show version and compile-time definitions
  -x            simulate the mailx send mode
  -y            select a mailbox specified in your `mailboxes' list
  -z            exit immediately if there are no messages in the mailbox
  -Z            open the first folder with new message, exit immediately if none
  -h            this help message

This is it with mutt command for now, read man pages of mutt for more information on mutt command.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
How VPS

How VPS

Related Posts

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Install Apache Tomcat 8 on CentOS 7
Linux

How to Install Apache Tomcat 8 on CentOS 7?

February 11, 2020
Install Arch Linux With Btrfs Snapshotting
Uncategorized

Install Arch Linux With Btrfs Snapshotting

February 13, 2020
Next Post

How To Move the Nginx Web Root to a New Location on Ubuntu 18.04

5 Interesting Command Line Tips and Tricks in Linux – Part 1

How to Setup Plesk on Amazon Web Services

How to Setup Plesk on Amazon Web Services

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow Us

  • 121 Followers
  • 87.2k Followers

Recommended

How to Install Bugzilla 5.0.x on CentOS 7

3 years ago

Installing OpenVPN on CentOS 7

3 years ago

How to Install Crate.IO on CentOS 7

3 years ago

11 Cron Scheduling Task Examples in Linux

4 years ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

Topics

Apache Web Server Bluehost Review 2019 Bluehost Review 2020 Bluehost Review 2021 Centmin Mod CentminMod centos install htop fsck htop install HTTP DoS attack Install Snort on an Ubuntu install Zabbix on CentOS install Zabbix on CentOS 7 Linux Commands linux guide linux install htop linux vps setup guide MariaDB MariaDB Error Mysql mysqld error optimize MariaDB optimize Mysql snort Ubuntu
No Result
View All Result

Highlights

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Webmin Reviews

Virtualmin Reviews

CentOS Web Panel Reviews

Ajenti Reviews

ISPConfig Reviews

Trending

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

by How VPS
February 25, 2022
0

I tried to update some extensions by use yum on centOs which I specified in Dockerfile. After...

How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020
Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

February 17, 2020
Webmin Reviews

Webmin Reviews

February 17, 2020
How VPS – How to use/setup VPS

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8 February 25, 2022
  • How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”? November 17, 2020
  • How to optimize Mysql or MariaDB November 3, 2020

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

[mc4wp_form]

© 2018 JNews - City News Magazine WordPress theme. All rights belong to their respective owners.
JNews is a top selling 2018 WordPress News, Blog, Newspaper & Magazine Theme.

No Result
View All Result
  • Home

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.