• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Setup mutt in CentOS/RHEL

By admin

Mutt is a full-featured text-based Mail User Agent that supports the typical mail formats and protocols while providing comprehensive support for MIME, GPG, and PGP. By its very nature Mutt is a very useful package, and because it is a tool that all server administrators should become familiar with, it is the purpose of this recipe to show you how Mutt can be used to deliver customized reports and messages to a destination of your choice.

Installing and Configuring mutt

1. Install the mutt RPM package if needed.

# yum install -y mutt

2. Review the online documentation:

# man mutt

3. Set your mail distribution server in the system-wide configuration file. Take a backup of the configuration file before making any changes.

# cp -p /etc/Muttrc /etc/Muttrc.ORIG
# vi /etc/Muttrc

### Change the mail handler to have a line reading:
smtp_url=smtp://mailserver.thegeekdiary.com

4. Save the file. restart any mutt sessions already active.

Sending e-mail Using mutt Command

Use mutt command in following format to specify subject, message body and attachment to send mail from command line.

# echo "" | mutt -s "subject" -i body.txt -a attachment.txt recipient@example.com

Here
-s is used to specify subject of mail.
-i is used to specify file containing message body.
-a is used to specify attachment file.

Some other commonly used options with mutt are:
-b is used to add Bcc address.
-c is used to add Cc address.
-e “unmy_hdr from; my_hdr From: test@test.com” – if you want to specify sender’s address (something other than default).

Mutt can also be used in interactive mode. To start it just type “mutt” on command line.

# mutt

How to Send an eMail in HTML Format Using mutt?

Use the below syntax to use mutt to send HTML mail:

# mutt -e "set content_type=text/html" [user@domain.com] -s "This is the subject" < /tmp/email_body.html

where,
/tmp/email_body.html has the html mail body.

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to find if a network port is open or not?
  2. After Reboot RAID1 Disk Gets Removed/Out of Sync (CentOS/RHEL)
  3. How to Transfer a File In Passive Mode by FTP
  4. Understanding chroot Jail
  5. CentOS / RHEL 6,7 : How to delete an iSCSI Target on the initiator (iSCSI client)
  6. CentOS/RHEL: “id” command doesn’t list the Group Name against GID for LDAP Users
  7. How to disable NUMA on EFI Boot Loaders using GRUB2 (CentOS/RHEL 6)
  8. How to Set “dev_loss_tmo” Value Persistently Using Udev Rule
  9. “Failed to Start Activation of LVM2 Logical Volumes” and “Unit lvm2-activation-net.service Entered Failed State” – CentOS/RHEL 7 booting issue
  10. When to use rescan-scsi-bus.sh -i (LIP flag) in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • SQL script to find tables that are fragmented
  • TRUNCATE TABLE not releasing space from tablespace
  • How to reclaim entire space of an oracle database table with “Truncate Table” statement
  • Oracle SQL Script to Report Tablespace Free and Fragmentation
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary