This Howtos posted under: Linux | Total Visitors Till Now: 453

How to send email via CLI

Here are a few ways on how to send email using terminal – CLI mode.

We are going to use mail command, as root:

# mail -s “test email” isp@google.com -c owner@google.com -b staff@google.com

This would send a blank email with “test email” as its subject. The email would be send to isp@google.com with CC to owner@google.com and blind CC to staff@google.com

# echo “How are you” | mail -s “test email” isp@google.com -c owner@google.com -b staff@google.com

would include “How are you” line as the body message of the email. This could be useful and incorporated from your shell scripts that does a particular function and informs you by email of its function result.

Another way is to

# mutt -s “test email” -a /root/pic.jpg isp@google.com -c owner@google.com -b staff@google.com

would send email with “test emai” as subject name. Email is addressed to isp@google.com, with CC to owner@google.com and BCC to staff@google.com. You will noticed the new parameter. This email would attached /root/pic.jpg picture to this email.

Now, piping it like so

# echo “How are you” | mutt -s “test email” -a /root/pic.jpg isp@google.com -c owner@google.com -b staff@google.com

would include “How are you” as body of the email.

Alternatively, you can install the old text based mail user agent pine

# yum -y install pine
# pine

Interactively, pine gives you text based menus to create, send and even check your current mails via terminal.


Editor  Posted by Editor on October 2, 2008 at 4:33 am

Be the first to comment - What do you think?  Tags: , , , , , , , , , , ,

Coolsearchinfo - A free Social Bookmarking Site

Liked this article? To continue getting our latest free Howtos and Tutorials,
you can also grab the RSS feed or Subscribe to Techgurulive by Email

Not Getting



Related posts
  • How to send Bulk Emails using Phplist – An Open Source Bulk Mailer Software
    phplist is an open-source newsletter manager. phplist is free to download, install and use, and is easy to integrate with any website.  Once you have installed and configured the phplist,...