Unix mail command internals

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unix mail command internals
# 1  
Old 09-15-2011
Unix mail command internals

Hi all ,

I wanted to know how does a 'mail' command works in unix. Does it use an smtp server internally ?
How and where it is configured then ? I am trying to google out the same , but not getting much help.

Any suggestions with be of great help.

- Andy
# 2  
Old 09-15-2011
What do you mean by "use an smtp server internally" ?
mail behaviour I believe depends on how it is implemented...
# 3  
Old 09-15-2011
Don't we need an smtp server to send out a mail .. What I meant was how does mail command sends out mails. How it is implemented internally. What do we need to do to set it up ?
# 4  
Old 09-15-2011
I suppose normally port 25 open...
mail was out before all our fancy Internet protocols in early ages boxes used to communicate via uucp and mail used it...
What OS you are on may help you know, I work mostly on HP (then solaris and aix...) and lately on linux servers and you do see some differences...
I would look if you dont have a /etc/mail directory, then if you have a sendmail.cf file that needs configuring...
I let others continue the discussion now
# 5  
Old 09-15-2011
How email's mostly used now is way different from how it originally worked. SMTP used to be something email servers used to push email to other email servers, not something clients used.

Client A would dial directly into a shell on server B, and send a message, ultimately, through sendmail, which talks directly to the server's own mail-transport agent(MTA). If the destination was on the same server, the email would be directly transferred to the recipient's maildir folder without any networking required at all. If the destination was on server C, the MTA would eventually need to open an SMTP connection elsewhere to transfer it. (It needn't do so instantly. It needn't do so directly, either. It might send to server E, which would forward to server C, etc.) Client D would dial into server C and check their local maildir folder for files to see if any mail had arrived.

In short, commandline mail didn't use an SMTP server -- commandline mail was an SMTP server. That's mostly how it remains.

Once home computers started getting network access, users were able to access POP and SMTP and IMAP to get mail remotely instead of directly shelling into your mail server, but the design of UNIX MTA's still reflects having local mail for local users.

There's lots and lots of different MTAs now. With few exceptions, they all look the same on the surface -- they all give you a commandline sendmail program to send mail with, etc. Many of them still even use configuration files based on ones the venerable sendmail server used -- even though their capabilities can be radically different. I suspect that's why trying to configure an MTA has involved so much brain damage for me. Others have suggested that the damage was there already Smilie

If all you want to do is have sendmail forward to existing email addresses somewhere else, I wouldn't bother setting up a full-fledged MTA. ssmtp is a tiny sendmail replacement which doesn't do any MTA duties at all, its sendmail command directly connects to remote SMTP servers of your choosing, like an ordinary email client would.

Last edited by Corona688; 09-15-2011 at 02:55 PM..
This User Gave Thanks to Corona688 For This Post:
# 6  
Old 09-15-2011
Thanks a lot Corona688 for the info .. Really helpful , can you refer me some links or books if possible about the same, in case you know some..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX mail command

I am using HP-UX server. I tried to send the email with attachment, I used the below unix command to send with attachment but it doent work. uuencode pepsitoday.csv | mailx -s "csv file" ramkumar15@pepsi.com ---------- Post updated at 02:10 AM ---------- Previous update was at... (2 Replies)
Discussion started by: ramkumar15
2 Replies

2. What is on Your Mind?

How to switch from SVR4/BSD internals to Linux internals?

Hello, Long-time Unix hacker here - I've worked on four variants of the kernel prior to the introduction of Linux. In my spare time, I've written Linux (Ubuntu) device drivers, kernel modules, cross-compiled, and built the kernel. I'd like to do Linux internals/device drivers as a day job,... (1 Reply)
Discussion started by: OriginalVersion
1 Replies

3. Shell Programming and Scripting

mail command in Unix

Hi All, Is it possible to email a file from another directory in Unix shell prompt? In other words, do we have to be in the directory where the file is located to mail the file? I was in the Mail directory and my file (filename) is in the Practice directory. I tried this and it didn't work:... (7 Replies)
Discussion started by: onlinelearner02
7 Replies

4. UNIX for Dummies Questions & Answers

Problems using Unix mail command (2)

I recently generated myself the following error when attempting to use the Unix mail command: The flags you gave make no sense since you're not sending mail. There is a recent thread about this issue here in unix.com (with a title very much like this thread's title), but it was closed... (2 Replies)
Discussion started by: Clovis_Sangrail
2 Replies

5. UNIX for Dummies Questions & Answers

Problem using unix mail command

Hello, When i am using mail command like this: mail -r prashant.aggarwal@xx.com -s "hiiii" prashant.aggarwal@xx.com < Content.txt i am abl eto dend a mail. Content.txt is a file from which contents are being reda But when i am trying to execute it thru a shell scipt like this it's giving ... (3 Replies)
Discussion started by: cprash.aggarwal
3 Replies

6. UNIX for Dummies Questions & Answers

Mail command in UNIX

1)My main script Calls a function IsDomain to check whether the domain is valid or not PROD>/appl/retek/mpscripts/cat mg3TRn01 #!/bin/ksh # # Standard Header Files # # . ${0%${0##*/}}UKMPFunctionLibrary.test # # START # ScriptStart # # Check that domain exists.Print &... (0 Replies)
Discussion started by: Shilpi
0 Replies

7. Programming

UNIX Internals, Help required...

I know UNIX user level commands, shell scripts. But i have no idea about kernel level programming and networking. I know the terms semaphore,IPC,socket programming. But i don't know in details what are these. I need to know the following. 1. Unix kernel level programming. 2. Unix Internals. 3.... (4 Replies)
Discussion started by: digdarshan
4 Replies

8. UNIX for Dummies Questions & Answers

UNIX mail command

hi, Im trying to send a e-mail to two people e.g X & Y . I run a shell script that uses the mail command to send an email to both these people . The email that i am sending contains two attatchments that i 'add' to a .mail file. mail <recipients> < filename.mail The problem that im... (1 Reply)
Discussion started by: nbvcxzdz
1 Replies

9. Filesystems, Disks and Memory

on unix internals

will anybody tell me how can i access all the fields of process table .if there is any structure and a system call please specify . (1 Reply)
Discussion started by: vish_shan
1 Replies

10. New to Unix. Which books should I read?

UniX internals Material

Hi! I have 1.5 years experience in unix environment and shell scripting. Now, I started learning UNIX internals and network programming. Can you please help in finding the same material on the net Thanks Srinivas. (7 Replies)
Discussion started by: srinivaskathika
7 Replies
Login or Register to Ask a Question