offer jobs schedule amazon media file explorer download upload index folder image licenses menu widget Play Pause profile-settings more dots-two-horizontal dots-two-vertical more-vertical pending google-plus hangouts facebook instagram whatsapp spotify telegram twitter vine renren rss youtube twitch vimeo flickr dribble behance deviantart 500px steam github soundcloud skype reddit linkedin lastfm delicious stackoverflow pinterest xing flattr foursquare yelp World

How To Send Mail To Multiple Addresses Using (mailx)

In this guide, you'll learn a couple of ways you can send mail to multiple addresses using mailx. mailx is a utility program for sending and receiving mail.

I assume you already have mailx command, if you don't already have it installed, use sudo apt install mailutils, once installed, we can get started using mailx.

To send mail to multiple address, you do the following:

echo "My message" | mail -s "My Mail Subject" firstuser@gmail.com seconduser@microsoft.com thirduser@yahoo.com andsoon@gmail.com

or by taking the message from a file (CD into the file directory, and use the following command):

mail -s "My Mail Subject" firstuser@gmail.com seconduser@microsoft.com < textfile.txt

Add Attachment to the Mail

Attachment can be added with the -aswitch:

echo "My Message Body" | mail -s "My Mail Subject" -a /path/to/file firstuser@email.com seconduser@email.com

You can also specify a from name address, use the -r option and wrap the name in "<>", e.g:

echo "My Message Body" | mail -s "My Mail Subject" -r "<youruser@server.com>"-a /path/to/file firstuser@email.com seconduser@email.com

Let's spice this up by using alias,add the list of users you want to send the mail to using:

alias mailadresses="user@gmail.com user2@gmail.com user3@gmail.com user100@gmail.com"

Then send the mail using:

echo "My message" | mail -s "My Mail Subject" mailaddresses

Enjoy!

Related Post(s)

  • Setting Up Send-Only Mail Server From Scratch (With Haraka)

    In this guide, I would walk you through the steps of setting up an email server that can be used as a send-only mail server, we would not be dealing with receiving mails, we only care about sending em

  • Send Mail with Attachment Using Mutt in GNU/Linux

    Mutt is a powerful text&#x2d;based mail client for Unix/Linux operating systems. It features color support, message threading, MIME support...

  • Using Pageant To Automatically Authenticate SSH key in Putty

    I can't count how many times I have typed my ssh key passphrase whenever my ssh connection times out, it is so annoying and repetitive. Well, thanks to the putty pageant, you can do that seamlessly.

  • Monitoring Multiple Log Files In RealTime With MultiTail (Ubuntu)

    Oh my... I really find scanning through the logs file time consuming, and painful. Luckily for me, I founded Multitail, which is an awesome, and powerful tool for not only browsing through several f

  • Test Your Internet Download Speed from Terminal Using (Fast)

    Fast is a tiny utility program for testing your internet download speed from the terminal, to get started, you simply install via the snap store (Ubuntu): sudo snap install fast If you don't have sna

  • Access A Web Page In GNU/Linux Using (Links) [Web Browser in Text Mode]

    Links is a text-mode World Wide Web (WWW) browses that can be used to view a web page either via a local (file://) or remote ((http:// or ftp://) URLs. To get started with Links, install it using the