LINUX - MAIL PROGRAM, SEND EMAILS FROM TERMINAL, SEND EMAILS FROM FILE, SEND MULTIPLE EMAILS AT ONCE

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@aschatria·
0.000 HBD
LINUX - MAIL PROGRAM, SEND EMAILS FROM TERMINAL, SEND EMAILS FROM FILE, SEND MULTIPLE EMAILS AT ONCE
![Screenshot_19.jpg](https://steemitimages.com/DQmNv4Tk4eug9izSJvpmHXC8GVTJjv6LYqjxo3FeJK9msbP/Screenshot_19.jpg)

**Linux is a fun thing to use, as you can get pretty much everything going within a few lines of a code. No need to download applications from the mysterious pages. Without losing time, a laptop can find it on its own, which is kind of amazing for me.**

Without a further ado, let me explain how to send an email from the Terminal command line. 

I'm using 32-bit Ubuntu 17.10 ( codename: artful) if something doesn't work quite as you planned from my tutorial you are either missing a library or your version is a bit different.
Not all versions are the same, especially because I am using older 32bit, and most of the people I know already have 64bit versions. 
And usually when there is a version for 32 there is one for 64. 
But, I am ok, I also have WinXP, the world didn't end and I write quite comfortably with it. I also have a dumbphone and it is the best piece of communication junk I ever owned. 
For me, the smartphone is a mini-computer that you can carry around and it is simply there to steal your family time.

The Terminal is the best thing ever because it spends less space and resources than a separate GUI interface, and it is very quick. 

*What is GUI?*
*It is a graphical user interface. That is simply said an application, a window or a box that you can see to use on your device.*

I am extremely grateful because I can do all things I like from one frame only, I don't need to open a few which can be pretty annoying.

For the email sending, you can install of course a 'real' application, at least the one that is visible, that you are used to having and the kind of an application that you can open from the Start Menu. So, if you dislike my idea of Terminal email, you can use for example the Geary.

**Geary** is an email application, and inbox for your mail. It is quite easy to download and install. 

Open your Terminal and type this.


```
sudo apt-get install geary
```

And.. you have it. Open the program, verify your email and you will start to receive the emails in a usual way for the desktop email program.

**But, if you want something more exotic, you would want to use the Terminal.**

Now, you could use the **Mutt**, but it will stop working within a few days of the activity.  I used only my Gmail on this Mutt program, because my other mail apps do not allow any POP/IMAP integrations. I guess there is a way to do it, but there is also an easier way, so why to bother. 

*I will make a tutorial on Mutt some other time, now I will only explain some basics.*

So, let's send an email.

First, you will need a program, of course.

So, open the Terminal and start typing.

```
sudo apt-get install mailutil
```
```
sudo apt-get install ssmtp
```
```
sudo vim /etc/ssmtp/ssmtp.conf

```

---> now hit 'i'

Find the line ( use Up and Down arrows) that says 

> FromLine Override=YES

... and delete little brackets ( # )

Add these lines, or fill them up with necessary information.

> AuthUser=yourusername@gmail.com
AuthPass=yourpassword ( you can use application specific password as well)
mailhub=smtp.gmail.com:587
Use STARTTLS=YES

Click on ESC and when you get an extra line below with ':' write 'wq' press Enter and a program will exit.

Now, you have all set, and you can send emails.

**Just one warning! Fireproof your main account ( online Gmail) with a Google OAuth or/and a phone, and you will be secure.**
You can also use an n application specific password for your desktop installation ( of any kind, not just this) and install some sort of a program to defend you from all malicious attempts.  If you are using this for shits and giggles, you don't need all that, carry on.

Now, you are out, the screen is empty, how do you send an email?

Let's try this. 

```
echo "text of a message" | mail -s "Title of your message" receiver@mail.com
```

Alt Gr ( right alt) + W = | 


Ok, but you want to style a message in the file and then send it because it will be a long message. 


Let's do everything without leaving the Terminal.

**Do not send a million emails, you will get blocked and blacklisted by Google, this is the same email box you usually use but the only difference is that you don't see an application window.**

First, you will need a place where you will keep your mail texts.
This command will create a directory or a folder where you will keep your message files.

```
mkdir Mail
```

Now, go inside of that directory, or a folder.

```
cd mail
```

Then you need to make a text file to write that message.
This command will create a file.

```
touch message.txt
```

Then you need to write something but you don't want to leave your Terminal. This is usually me. I hate opening too many tabs and windows. 

```
cat > message.txt
```

Now, write whatever you have and then press CTRL+D.

Take a look what you did in nano editor, add things if you need. You can also take a look at it with vim, vi or open it in the message folder.

```
nano message.txt
```

Ok, you have all that set, now let's send it. If you are only testing,  use your spare email till you learn how to do things properly. 

```
mail -s "title of your message" receiver@mail.com  <  /home/yourusername/Mail/message.txt
```

This command will send your message with a  body of a message written in the text file message.txt to the receiver@mail.com.

If you want to send to the multiple recipients, you have to specify it.

```
a="email1@mail.com, email2@mail.com, email3@mail.com"
```
```
mail -s "title of your message" $a  <  /home/yourusername/Mail/message.txt
```

I still like to send emails one by one, but if you need for any reason to send a message to a group, that is an easy and fast way.

Also, everything you send in this way will be visible in your email online account as well, so you can't miss anything, you can always check this.



I really enjoyed making this simple, basic tutorial for you, I hope you will put it into a good use and spare your time.


### Thank you for reading and visiting my blog!


<center><img src="https://steemitimages.com/DQmcbzh5zSywPA4DysW6gg6VCfmnZX3M2ACjwQ4AKNfBu3R/Untitled%20design.png"/></center>

<hr/>
<center><i>This post will be submitted within my interest zone in the communities listed in tags and banners </i></center>
<hr/>


#steemrepair
#qurator
#steemiansarena
#dynamicsteemians
#adsactly
#preppersonline
#ocd-resteem
<hr/>

<center><img src="https://i.imgur.com/7Yf0IAL.jpg"/><br/><br/>

<a href="https://discord.gg/vnbMHjM"><img src="https://i.imgur.com/8j8zmhA.png"/></a>

<a href="https://discord.gg/pJtWp57"><img src="https://steemitimages.com/DQmarWRv4wXiqPZbmtDCDRTwE5jewDQrG1ATrXcFrTThxht/Gifbanner.gif"/></a>

<a href="https://discord.gg/2WmTac9" ><img src="https://steemitimages.com/DQmQ5g8rLXMAUT9Tn3eCf1KbpPkcD9HeScxPnRJDDsmMrf7/ssteemians.png" ></a>

<a href="https://discord.gg/EwGhEzb" ><img src="https://i.imgur.com/t6dLyUu.jpg?1"></a>

<a href="https://discord.gg/255Td3q"><img src="https://steemitimages.com/DQmdhXd6XbeumeAxaS6XRFAnvKxk7VfeCzMnopNKatwuUf7/preppersonline.png)"></a>



</center>
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,