LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-10-2012, 09:41 AM   #1
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Rep: Reputation: 21
Question mail command doesnt work!


I have recently installed fedora16 now when I am trying to run the command

mail -s "Test email" x@somewhere.com.I am getting the error command not found.How can I downlaod it.
 
Old 05-10-2012, 11:03 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Not tested, and I don't know the package name, but something like:

Code:
sudo yum install mail
might work.
 
Old 05-10-2012, 08:17 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,252

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Try 'mailx' instead.
Actually, try
Code:
rpm -qa|grep -i mail
to see what mail related pkgs are installed.
 
Old 05-11-2012, 06:45 AM   #4
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Original Poster
Rep: Reputation: 21
Question

Hi Chris,
I have downloaded the mailx utility but when I am trying to send the mail mentioned in the thread http://www.linuxquestions.org/questi...d-line-943861/ I am not able to send the mail.I have installed fedora 16 on a virtual machine and then I am trying to send a mail to my yahoo account from the terminal.
When I run this command mail -s "Test mail" xyz@somewhere.com my bash prompt gets stuck and I have to press ctrl D to get it back.
When I run your other command (uname -n) |mail -s "test email" xyz@somewhere.com it runs but when I check my yahoo account I dont have the mail.I am behind a proxy.But I can access the internet from my guest OS.Is there some setting that I am missing?

Last edited by Ajit Gunge; 05-11-2012 at 06:47 AM.
 
Old 05-11-2012, 07:49 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by Ajit Gunge View Post
When I run this command mail -s "Test mail" xyz@somewhere.com my bash prompt gets stuck and I have to press ctrl D to get it back.
That's normal. mail (and mailx) read the body of the email from stdin. Either you type the mail directly and terminate with Ctrl+D or you use echo <text of mail body> | mail -s "Test mail" <email address>

You also need a "mail transfer agent" (MTA) to transfer mail from the local machine to the likes of Yahoo's servers. Popular MTAs are exim, postfix and sendmail.
 
1 members found this post helpful.
Old 05-11-2012, 08:00 AM   #6
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by catkin View Post
That's normal. mail (and mailx) read the body of the email from stdin. Either you type the mail directly and terminate with Ctrl+D or you use echo <text of mail body> | mail -s "Test mail" <email address>

You also need a "mail transfer agent" (MTA) to transfer mail from the local machine to the likes of Yahoo's servers. Popular MTAs are exim, postfix and sendmail.
Hi catkin.Thanks for the information.I have downlaoded the sendmail MTA.I run the command mail -s "Test mail" <email address> but I still dotn see the email at my yahoo account.Is there something more that I have to do.
 
Old 05-11-2012, 08:42 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by Ajit Gunge View Post
Is there something more that I have to do.
Yes -- you need to configure sendmail.

sendmail is powerful and flexible. So it needs a lot of configuring. Depending on exactly what you want to do, you will need "smarthost" and "masquerade" in the configuration.

Sendmail links:Let us know how you get on.
 
Old 05-14-2012, 08:28 AM   #8
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Original Poster
Rep: Reputation: 21
Question

Thanks catkin for your inputs.I have doubts.I installed the sendmail using the [QUOTE][/yum install sendmail command.QUOTE].Now what I want is to read the readme file for the sendmail but I dontknow where it is install and how to access the readme file.I am following the links mentioned by you.
 
Old 05-14-2012, 10:52 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
How do you want to configure sendmail? Which ISP (mail service provider) do you want to send mail to?

Your outgoing mail will have to appear to come from a publicly resolvable domain name. Which domain name do you want to use?
 
Old 05-14-2012, 11:03 AM   #10
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Original Poster
Rep: Reputation: 21
Right now all I want to do is test if I can send a mail to my yahoo account from command line.I am not sure of which ISP I want to use.I want it at my yahoo account so I guess it is yahoo.The domain name should be yahoo.com I guess.
 
Old 05-14-2012, 11:37 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
IDK RHEL or Fedora so don't know what they give you as a starting point for configuring sendmail.

Here's how I set it up on Slackware for a similar setup (but not Yahoo for either the SMTP server to send the mail to or as the masqueraded origin domain). My computer is called CW8 so you will want to change that. In case of multiple attempts, this is version 1 or v1. You may have a /usr/share/sendmail/cf/cf directory but you will not have the sendmail-slackware.mc sample configuration file.

If you want to forward all mail to root to your Yahoo mail, add a line to /etc/mail/aliases, something like
Code:
root:Ajit@yahoo.co.in
and maybe (I do this but it may not be necessary with the alias), /root/.forward with
Code:
Ajit@yahoo.co.in
You will need to put your Yahoo username and password in /etc/mail/authinfo, something like
Code:
AuthInfo: "U:Ajit@yahoo.co.in" "P:really_hard_password_no_one_can_guess" "M:PLAIN"
Code:
root@CW8:~# cd /etc/mail \
    && chmod 400 authinfo \
    && makemap hash authinfo < authinfo \
    && newaliases \
    && mv sendmail.cf sendmail.cf.original\
    && cd /usr/share/sendmail/cf/cf \
    && cp -p sendmail-slackware.mc sendmail-slackware.CW8.v1.mc \
    && vi sendmail-slackware.CW8.v1.mc \
    && diff -u sendmail-slackware.mc sendmail-slackware.CW8.v1.mc 
/etc/mail/aliases: 16 aliases, longest 22 bytes, 188 bytes total
--- sendmail-slackware.mc	2010-04-24 04:26:15.000000000 +0530 
+++ sendmail-slackware.CW8.v1.mc	2012-04-10 21:32:47.597000287 +0530 
@@ -1,3 +1,4 @@ 
+dnl#@ Local changes identified by comment introducer dnl#@ 
 dnl# This is the default sendmail .mc file for Slackware.  To generate 
 dnl# the sendmail.cf file from this (perhaps after making some changes), 
 dnl# use the m4 files in /usr/share/sendmail/cf like this: 
@@ -10,13 +11,15 @@ 
 dnl# cp config.cf /etc/mail/sendmail.cf 
 dnl# 
 include(`../m4/cf.m4') 
-VERSIONID(`default setup for Slackware Linux')dnl 
+dnl#@VERSIONID(`default setup for Slackware Linux')dnl 
+VERSIONID(`CW8 version 1')dnl 
 OSTYPE(`linux')dnl 
 dnl# These settings help protect against people verifying email addresses 
 dnl# at your site in order to send you email that you probably don't want: 
 define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl 
 dnl# Uncomment the line below to send outgoing mail through an external server: 
-dnl define(`SMART_HOST',`mailserver.example.com') 
+dnl#@ define(`SMART_HOST',`mailserver.example.com') 
+dnl define(`SMART_HOST',`<here you put the name of Yahoo's SMTP server>') 
 dnl# No timeout for ident: 
 define(`confTO_IDENT', `0')dnl 
 dnl# Enable the line below to use smrsh to restrict what sendmail can run: 
@@ -34,9 +37,18 @@ 
 FEATURE(`redirect')dnl 
 dnl# Turn this feature on if you don't always have DNS, or enjoy junk mail: 
 dnl FEATURE(`accept_unresolvable_domains')dnl 
-EXPOSED_USER(`root')dnl 
+dnl#@ Local additional FEATURES 
+FEATURE(authinfo) 
+FEATURE(delay_checks)dnl 
+FEATURE(masquerade_envelope)dnl 
+FEATURE(allmasquerade)dnl 
+FEATURE(masquerade_entire_domain)dnl 
+dnl#@EXPOSED_USER(`root')dnl 
 dnl# Also accept mail for localhost.localdomain: 
 LOCAL_DOMAIN(`localhost.localdomain')dnl 
 MAILER(local)dnl 
 MAILER(smtp)dnl 
 MAILER(procmail)dnl 
+dnl#@ Local additions 
+MASQUERADE_AS(`<here you put the domain you masqureade as -- yahoo.com?>')dnl 
+DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA') 
root@CW8:/usr/share/sendmail/cf/cf# sh Build sendmail-slackware.CW8.v1.mc
root@CW8:/usr/share/sendmail/cf/cf# cp -p sendmail-slackware.CW8.v1.cf /etc/mail/sendmail.cf
Good luck. The above are ideas to get you started. Maybe Yahoo has special requirements. I've done similar for Gmail and Google mail; they required the SMTP server port to be specified.
 
1 members found this post helpful.
Old 05-17-2012, 04:09 AM   #12
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Original Poster
Rep: Reputation: 21
Hi Catkin,
Thanks for you response.I am uisng Fedora 16.You said your cmputer is called CW8 mine currently is called localhost.How can I change that.Also it seems that a lot of files that you mentioned are not there in my setup like /etc/mail/alaises,/root/.forward.I am trying to figure out how to do the changes you suggested for fedora following few tutotials online.Will let you know if I succeed.Thanks
 
Old 05-17-2012, 05:15 AM   #13
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
IDK Fedora but ...

A netsearch suggests you have to edit /etc/sysconfig/network to change the hostname.

A netsearch suggests that Fedora uses /etc/alaises. Does that exist?

/root/.forward does not normally exist. It may not be necessary when using aliases. Pages about /root/.forward on Fedora listed here.
 
Old 05-17-2012, 06:13 AM   #14
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Original Poster
Rep: Reputation: 21
HI catkin.
For the hostname changes I am trying to follow the instruction given here but I am stuck at the steps 4-7 as I cannot find the sytem tab under my system to configure the dns.Please let me know what am I missing.I do have the file /etc/alaises.I am trying with the changes you suggested.Will let you know my findings.
 
Old 05-17-2012, 07:50 AM   #15
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
If System -> Administration -> Network isn't working for you, edit /etc/sysconfig/network directly. You will need to be root to do that.
 
  


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
Mail doesnt work on my CentOS in LAN kumars.nitin123 Linux - Server 2 11-05-2009 06:31 AM
my iptables command doesnt work rohit83.ken Linux - Networking 1 04-01-2008 07:24 AM
My router command doesnt work digital bots Linux - Networking 1 05-24-2004 02:23 PM
./wlanup command doesnt work Kilahchris Linux - Wireless Networking 4 05-10-2004 10:48 PM
Mozilla Mail change font doesnt work dsp Linux - Software 0 04-01-2003 03:51 AM


All times are GMT -5. The time now is 02:50 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration