LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-17-2003, 08:37 PM   #1
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Rep: Reputation: 30
can someone explain what the mail command does?


Ok,first of,let me say that I'm a newbie and need things explained in a clear simple manner. Also,let me say that I have done #man mail and read it and still don't understand it.

What I want to know about 'mail' is:

1. is the' mail' command some sort of quick way of sending mail to other users on your machine rather than via proper email (Evolution etc)?

2.Do you need to set anything up for this,or do users automatically have inboxes for incoming mail?

3,From what I've read, I can send ' user1' a message simply by typing
# mail user1
and then writing in my message.
IS that right?

4.What I don't understand is where do the messages get sent to on the system? If I send a message to myself,what file does it go to?

5. How do I read a message if I send it to myself?



any help much appreciated.
Ludwig
 
Old 05-17-2003, 10:45 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
You can use the mail command to send mail to anyone. So if you have a yahoo account you could say:
Code:
mail -s 'did this work?' jow_blow@yahoo.com <enter>
Type you message here
.
If you don't supply the subject, it will prompt you. The period on the last line signifies the end of the message. Or as you mentioned you can send it to a user ie:

mail user1

just as you mentioned.

The mail to users will go to /var/spool/mail/user1 where it waits to be fetched by you. The /var/spool/mail/username holding area is created automagically when you create a new user. You can use evolution or any other email client to pick up this mail, just read the docs to set up your local account...

btw your full address will be user@hostname, so if you have a FQDN you can send mail to your computer from anywhere, else you can only recieve from your box.

Last edited by bulliver; 05-17-2003 at 10:50 PM.
 
Old 05-17-2003, 10:58 PM   #3
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
thanks bulliver.
That's really clear.


cheers
Ludwig
 
Old 05-17-2003, 10:59 PM   #4
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
No prob
 
Old 05-17-2003, 11:20 PM   #5
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
Just one quick question:
what is 'hostname' in:

btw your full address will be user@hostname ??
 
Old 05-17-2003, 11:27 PM   #6
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
run uname -n, that's your hostname. If you haven't set it it is almost certainly 'localhost' You can set your own using the hostname command ie:
hostname myCrazyComputer

This will not persist between reboots however. If you want to set your hostname permanently search this site for a million explanations how...

As I was saying though, you need a FQDN for this to work with the mail command. I got a free one from no-ip, so in my /etc/hosts file looks like:
Code:
#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1           badcomputer.localdomain localhost
24.84.255.105    badcomputer.badcomputer.no-ip.com badcomputer
And my username is bulliver so you can send me mail at bulliver@badcomputer.no-ip.com

Of course this assumes I have an MTA listening at port 25....

Last edited by bulliver; 05-17-2003 at 11:32 PM.
 
Old 05-17-2003, 11:35 PM   #7
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
hi there,
When i do uname -n I get
localhost.localdomain

I was wondering if this is my hostname since you said it would almost certainly be 'localhost'.

cheers
Ludwig
 
Old 05-17-2003, 11:37 PM   #8
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
That would be it
 
Old 05-17-2003, 11:39 PM   #9
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
One other quick question while I'm on the subject of mail:

when I do
#mail
I get quite a few old mails in there.
I read that to delete them you just type
#delete N
where N is the number of the email you want to delete.
However,when I do that ,exit and do #mail again, the mail that i deleted is still there. Why is that,do you think?

cheers
Ludwg
 
Old 05-17-2003, 11:43 PM   #10
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Well, this one has me stumped....I'm sure I don't know. Usually the /var/spool/mail/ directories are holding tanks right? That's where the mail stays until you use a mail reader to get it, then it gets moved to your personal mail folder (typically ~/Mail) where you can do what you wish with it.

I may be wrong but I don't think you are supposed to directly read/delete mail from the /var/spool/mail area, rather, set up a client to fetch it for you.
 
Old 05-17-2003, 11:46 PM   #11
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
actually,I found a way to do it
What I did was I set up evolution to read the local mail and then deleted it from Evolution.
Dont know why it didn't work before.Maybe you are right,you need to do it from a client.

Anyway,thanks very mch for your help.
I really appreciate it .

cheers
ludwig
 
  


Reply



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
explain this command please varunbihani Linux - General 9 07-09-2005 02:48 AM
Cannot send mail with mail() command in PHP 4.3.4, Apache 2.0.48, Mandrake Linux 10 arcanum Linux - General 3 06-27-2004 06:06 PM
mail is not delivered thru the mail command aadilkhan Linux - General 1 11-18-2003 05:37 PM
cannot receive mail -- mail command andy18 Linux - General 1 09-09-2003 03:13 PM
Using the 'mail' command to mail a file Crashed_Again Linux - Software 2 08-08-2003 05:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:18 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
Open Source Consulting | Domain Registration