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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
05-10-2012, 08:41 AM
|
#1
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Rep:
|
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.
|
|
|
05-10-2012, 10:03 AM
|
#2
|
Senior Member
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
|
Not tested, and I don't know the package name, but something like:
Code:
sudo yum install mail
might work.
|
|
|
05-10-2012, 07:17 PM
|
#3
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,391
|
Try 'mailx' instead.
Actually, try
Code:
rpm -qa|grep -i mail
to see what mail related pkgs are installed.
|
|
|
05-11-2012, 05:45 AM
|
#4
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Original Poster
Rep:
|
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 05:47 AM.
|
|
|
05-11-2012, 06:49 AM
|
#5
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
Quote:
Originally Posted by Ajit Gunge
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.
|
05-11-2012, 07:00 AM
|
#6
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Original Poster
Rep:
|
Quote:
Originally Posted by catkin
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.
|
|
|
05-11-2012, 07:42 AM
|
#7
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
Quote:
Originally Posted by Ajit Gunge
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.
|
|
|
05-14-2012, 07:28 AM
|
#8
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Original Poster
Rep:
|
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.
|
|
|
05-14-2012, 09:52 AM
|
#9
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
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?
|
|
|
05-14-2012, 10:03 AM
|
#10
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Original Poster
Rep:
|
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.
|
|
|
05-14-2012, 10:37 AM
|
#11
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
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
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.
|
05-17-2012, 03:09 AM
|
#12
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Original Poster
Rep:
|
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
|
|
|
05-17-2012, 04:15 AM
|
#13
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
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.
|
|
|
05-17-2012, 05:13 AM
|
#14
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Original Poster
Rep:
|
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.
|
|
|
05-17-2012, 06:50 AM
|
#15
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
If System -> Administration -> Network isn't working for you, edit /etc/sysconfig/network directly. You will need to be root to do that.
|
|
|
All times are GMT -5. The time now is 12:24 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|