send mail from terminal kubuntu linux


ok you need to send an email properly ? you need to do this

i am using kubuntu so when i test mail or mailx i can do what i want but i get some problems that because i have a wrong version of mailx and so you need to install this one

sudo apt-get install heirloom-mailx 

now we need to create a file in $HOME/.mailrc so :

kate $HOME/.mailrc  

put this stuff here :

account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=MYUSERNAME@gmail.com
set smtp-auth-password=MYPASSWORD
set from="NAME OR WHAT YOU WANT"
}

ok now :

echo "my shell email" | mailx -v -A gmail -s "Thi is a title" TARGET_MAIL@gmail.com 

You should see this :

Resolving host smtp.gmail.com . . . done.
Connecting to 74.125.136.108:587 . . . connected.
220 mx.google.com ESMTP mx19sm2120686wic.3 - gsmtp
>>> EHLO sem-SVE1512Y1ESI
250-mx.google.com at your service, 
BLA BLA BLA 
..
..
250 2.0.0 OK 1409139516 mx19sm2120686wic.3 - gsmtp
>>> QUIT
221 2.0.0 closing connection mx19sm2120686wic.3 - gsmtp

instead if you want just test shortly this mail stuff without authentification :

use this :
BUT IT WILL GO IN THE SPAM FOLDER …. SO THIS IS NOT RECCOMENDED

echo "This is the body" | mail -s "This is the subject" TO_USER@gmail.com -- -f FROM_USER@gmail.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: