LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-18-2010, 09:44 AM   #1
Ubunoob001
Member
 
Registered: Feb 2010
Location: New Orleans, LA
Distribution: Mint 16 RC, Elementary OS Luna, Crunchbang
Posts: 166

Rep: Reputation: 16
Smile Command Line Email (gmail) setup


Hey all, Im pretty new to C.L.I/text editing work. So maybe its a bit old-fashioned but Im interested in learning how to send email via the command line. I am running 10.04 32 bit

Situation: I have followed the explicit and step-by-step actions at http://klenwell.com/is/UbuntuCommandLineGmail

Question: Upon completion, when trying to send a test email to myself via gmail (from CLI) I get the following error: "msmtp: no recipients found". In CLI below it asks me to explicitly pick a mailx to download. I think I already have mailx as when I type mailx I get "no mail for primary".

Thanks in advance!

Here is my work
Code:
:~$ sudo apt-get install msmtp mailx
[sudo] password for:
Reading package lists... Done
Building dependency tree      
Reading state information... Done
msmtp is already the newest version.
Package mailx is a virtual package provided by:
  mailutils 1:2.1+dfsg1-4ubuntu1
  heirloom-mailx 12.4-1.1
  bsd-mailx 8.1.2-0.20090911cvs-2ubuntu1
You should explicitly select one to install.
E: Package mailx has no installation candidate
:~$ gedit ~/.msmtprc
:~$ chmod 600 ~/.msmtprc
:~$ gedit ~/.mailrc
:~$ echo -e "testing email from the command line" > /tmp/test_email
:~$ mailx -s "mailx gmail test" xxxxxxx@gmail.com < /tmp/test_email
msmtp: no recipients found
here is ~/.msmtprc
Code:
# config options: http://msmtp.sourceforge.net/doc/msmtp.html#A-user-configuration-file
defaults
logfile /tmp/msmtp.log

# gmail account
#account gmail
auth on
host smtp.gmail.com
port 587
user xxxxxx@gmail.com
password xxxxxx
from xxxxxx@gmail.com
tls on
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt

# set default account to use (not necessary with single account)
#account default : gmail
and here is ~/.mailrc
Code:
  # set smtp for mailx

# gmail account (default)
# $ mailx -s "subject line" -a /path/attachment recipient@email.com < /path/body.txt
set from="xxxxxx@gmail.com (xxxxx)"
set sendmail="/usr/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"

Last edited by Ubunoob001; 11-03-2010 at 12:44 PM.
 
Old 09-18-2010, 10:20 AM   #2
netmar
LQ Newbie
 
Registered: Jul 2004
Location: Durham, NC
Distribution: Ubuntu 10.04 (I'd rather use Gentoo)
Posts: 23

Rep: Reputation: 3
Unless your CLI environment lacks even rudimentary terminal encoding (like vt100), you may want to consider using a more capable email client than mailx.

You could try using alpine (just sudo apt-get install alpine -- I think it's in universe). It's the successor to the old pine email client, and is probably the easiest cli email client you'll find.

It's also about as full-featured as you could want, including a method to store the config on your IMAP server so that all your alpine configs(if you run it on different machines) can be updated at once. Setting up the client is pretty straightforward, too. Just use the arrow keys to navigate to SETUP, press enter, and press C for config. You'll get a long list of options, and there are prompts at the bottom of the page that list the available commands.

There are other options for a cli email client including my personal favorite mh, which integrates with the command line, but none that are easier to use.
 
1 members found this post helpful.
Old 09-18-2010, 12:33 PM   #3
Ubunoob001
Member
 
Registered: Feb 2010
Location: New Orleans, LA
Distribution: Mint 16 RC, Elementary OS Luna, Crunchbang
Posts: 166

Original Poster
Rep: Reputation: 16
Smile

Quote:
Originally Posted by netmar View Post
Unless your CLI environment lacks even rudimentary terminal encoding (like vt100), you may want to consider using a more capable email client than mailx.

You could try using alpine (just sudo apt-get install alpine -- I think it's in universe). It's the successor to the old pine email client, and is probably the easiest cli email client you'll find.

It's also about as full-featured as you could want, including a method to store the config on your IMAP server so that all your alpine configs(if you run it on different machines) can be updated at once. Setting up the client is pretty straightforward, too. Just use the arrow keys to navigate to SETUP, press enter, and press C for config. You'll get a long list of options, and there are prompts at the bottom of the page that list the available commands.[...]
Great thanks so much for the suggestion! Any thoughts on why my mailx setup failed? I may head back here with an alpine question in a bit. Thanks again!
 
Old 09-18-2010, 01:16 PM   #4
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
One cant send mail until and unless you give smtp server name to any email client...
You can send mail from your linux system if its server and supports relaying...

check for postfix or sendmail service running on your system or not and try sending mail from your CLI on command prompt itself

$mail -s "testmail" ........

Last edited by prayag_pjs; 09-18-2010 at 01:17 PM.
 
Old 09-18-2010, 08:59 PM   #5
Ubunoob001
Member
 
Registered: Feb 2010
Location: New Orleans, LA
Distribution: Mint 16 RC, Elementary OS Luna, Crunchbang
Posts: 166

Original Poster
Rep: Reputation: 16
Smile Thanks Netmar

Quote:
Originally Posted by netmar View Post
Unless your CLI environment lacks even rudimentary terminal encoding (like vt100), you may want to consider using a more capable email client than mailx.

You could try using alpine (just sudo apt-get install alpine -- I think it's in universe). It's the successor to the old pine email client, and is probably the easiest cli email client you'll find.

It's also about as full-featured as you could want, including a method to store the config on your IMAP server so that all your alpine configs(if you run it on different machines) can be updated at once. Setting up the client is pretty straightforward, too. Just use the arrow keys to navigate to SETUP, press enter, and press C for config. You'll get a long list of options, and there are prompts at the bottom of the page that list the available commands.

There are other options for a cli email client including my personal favorite mh, which integrates with the command line, but none that are easier to use.
Alpine is exactly what I was looking for! Many thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
line wrapping email in kubuntu 8.04 with seamonkey and gmail RON Howe General 0 03-03-2009 11:46 PM
Command line pop3/gmail email sender Maverick1182 Linux - Newbie 2 03-02-2008 01:08 AM
GMail command line mail client introuble Linux - Software 5 11-03-2006 07:29 AM
Command line tool like fetchyahoo to fetch gmail? SharpyWarpy Linux - Software 2 09-07-2004 04:39 PM
old command line email trick LinuxLala Linux - General 4 03-11-2004 11:56 PM


All times are GMT -5. The time now is 01:19 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration