How to receive mails in unix .....


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to receive mails in unix .....
# 1  
Old 08-23-2012
How to receive mails in unix .....

HI experts,

By using mailx command i can send mails to any email id. and my DNS is like
oper@xyz.com ..... but if someone replied to the mail sent earlier using mailx command. then how to recieve or view that mail ...

Is dre any command to do the same ... Im working on some project and got stucked in this scenario. any help appreciated.

Plz do reply with the program/example ....
# 2  
Old 08-23-2012
No idea about how to check mails on unix.

But can use FROM option and give your mail id for the FROM so the receiver gets the mail as sender as you. And they can reply to your mail id. Try if this is feasible solution for you.
# 3  
Old 08-23-2012
Hi,

I didn't get it clearly. Can you please provide the example. Thanks.

Last edited by Scott; 08-23-2012 at 06:37 AM.. Reason: Please no cyber-chat. Speak proper ;)
# 4  
Old 08-23-2012
Looks like you don't understand how mail (the system - not the command) works. Here is a very stripped-down (and inclomplete) explanation:

The backbone of the whole mail business is the "MTA", short for "Mail Transfer Agent". Think of its operation similar to what routers do to network packets: they have some rules which sorts of mails to send where and the rest is tossed to some default destination which hopefully can do something about these. On the other side of these connections there are similar MTAs, which pick up the received mails and either deliver them locally or again send them to other such MTAs, and so on and so on. This means that all these MTAs have to adhere to a "common language" to understand each other and in fact they do: they all use a certain special network protocol, called SMTP (Simple Mail Transfer Protocol), which is used to transport mails around. Examples for such MTAs would be "sendmail" or "postfix" or "exim", but also "Microsoft Exchange Server", albeit the latter should be taken with a grain of salt, because it does not adhere to all the accepted internet standards (see the RFCs 822, 1123, 1893, 2476, etc., etc.).

Now, this describes how mails are shuffled around, but what has to happen to originate/deliver a mail?

Well, on the other side of this backbone structure we have user programs - "mail" and "mailx" being two of them, but also "Mozilla Thunderbird" or other elaborate programs. More precisely these are called "MUA"s, "Mail User Agent"s.

So that leaves us with the last part - how do MTAs and MUAs interact?

We have already seen how the MTA acts on the outside, maintaining connections to other MTAs. "On the inside", that is: on the local system it runs at, it maintains queues for a all the mail users it knows to be local. Any mail directed at such a local user will not be sent outside by the MTA, but delivered locally. Because the MTA is a "daemon" (a process which runs all the time in the background) it will maintain these queues permanently. Usually these are not more than files in "/var/spool/mail" or "/var/mail" or a similar directory.

Most shells have provisions for regularly checking these queues for new entries. The Korn shell (ksh) and the Bourne again shell (bash) for instance have the system variables "MAIL", "MAILCHECK" and "MAILPATH", in other shells there are similar provisions.

The shell now checks in given intervals (MAILCHECK is a number of seconds, which sets the frequency) if the queue file has changed, which would mean arrival of new mail and then displays a configurable mail message (usually "You have new mail." or something similar). The user now can start his MUA, which pulls the messages out of the queue and into a privately maintained mail file (usually in the users home directory). Graphical email clients like Thunderbird tend to do this in the background because they are permanently open, but they wouldn't need to be, as much as e-mail as a system is concerned.

If a mail is written the MUA will send it to the MTAs outgoing queue, from where the MTA will pick it up and ... see above. In this regard, basic programs like "mail" and feature-rich email-clients like Thunderbird are alike.


Finally, to answer your original question:

You write a mail. "mailx" puts it into the outgoing queue of some MTA, which takes it from there and sends it to another MTA, which delivers it to the incoming mail queue of its local user, from where the users MUA picks it up and displays it. As the MTA on your side seems to be correctly configured (otherwise it wouldn't have been able to deliver your mail first) the recipient of your mail can employ the same way to answer you back.

I hope this helps.

bakunin

Last edited by bakunin; 08-23-2012 at 06:20 AM..
This User Gave Thanks to bakunin For This Post:
# 5  
Old 08-23-2012
Quote:
Originally Posted by ankitknit
Hi,

I didn't get it clearly. Can u plz provide the example.. Thanx
Try this... check if that can do your task..?

Code:
DIR_FILES=/temp/#give some path 
EMAIL_TO=abc@abc.com
EMAIL_FROM=xyzl@xyz.com
ATTACHED_FILE="file_name"#give file name present at the given path
EMAIL_SUBJECT="Your subject"
EMAIL_TEXT="Email text...."
E_MESS=mail.tmp


echo "To:      $EMAIL_TO" > $DIR_FILES/$E_MESS
echo "From:    $EMAIL_FROM" >> $DIR_FILES/$E_MESS
echo "Subject: $EMAIL_SUBJECT" >> $DIR_FILES/$E_MESS
echo "" >> $DIR_FILES/$E_MESS
echo $EMAIL_TEXT >> $DIR_FILES/$E_MESS

uuencode $DIR_FILES/$ATTACHED_FILE $ATTACHED_FILE >> $DIR_FILES/$E_MESS
cat $DIR_FILES/$E_MESS | /usr/sbin/sendmail -t

# 6  
Old 08-23-2012
@ankitnit
Please post what Operating System and version you are running?
Code:
uname -a  # Blotting anything confidential with Xs

Is this a server or a workstation?

The short answer is to use mailx . With no parameters the
mailx command provides a simple interface to read mail from your local server.

The long answer is to configure a more user-friendly mail client, but at the moment we know nothing about your computer(s).

What most people actually do is make the "reply to" address on outgoing mail match an existing external mail account.


@pamu
What has your post go to do with reading mail or using mailx?

Last edited by zaxxon; 08-23-2012 at 07:56 AM.. Reason: removed a slash at the opening [->/<-icode]
# 7  
Old 08-23-2012
Quote:
Originally Posted by methyl

@pamu
What has your post go to do with reading mail or using mailx?
Hi Methil,

See my previous post.
As i mentioned there an alternative way to get the reply mail from the receivers....
Hope this clear to you..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Unable to receive mails from email relay server

Hi, I have reports that are generated in one server (10.61.1.108), hostname l28bi01. These reports are supposedly sent to a group of email addresses hourly via an email relay server. However, this is not happening. In sendmail.cf in bi01, the DS Smart Relay Host ip address is: ... (3 Replies)
Discussion started by: anaigini45
3 Replies

2. Shell Programming and Scripting

Send Receive Mails

Hi All, I am writing one script to automate one long process. In this process we need to upload some input files and download some output files. So , I want to automate this upload and download by using mail functionality. I want to trigger this script when I am sending mail to server. I know... (0 Replies)
Discussion started by: NirajThakar
0 Replies

3. UNIX for Advanced & Expert Users

Checking Mails Using Unix

Hi..Is it possible for unix to monitor outlook for a particualr period of time and trigger oracle upon receiving a mail with particular content... Thanks in advance (1 Reply)
Discussion started by: varadharajan87
1 Replies

4. AIX

Unable to receive mails

Hi, can any one help as i am unable to receive mail to outlook mail box from aix box. Kindly help. (2 Replies)
Discussion started by: richajoy
2 Replies

5. Shell Programming and Scripting

I could not receive the mail sent from the unix server using 'mailx'

Hi All, I have sent a mail to my gmail id using the below command. echo " " | mailx -s "sub" myid@gmail.com I didn't get any error notification. But still I didn't receive that mail still.. please help me to learn how to send mail to other provider (Yahoo/gmail) from unix server.... (1 Reply)
Discussion started by: little_wonder
1 Replies

6. UNIX for Dummies Questions & Answers

I can send but cannot receive mail with unix?

Hi all, First post! I have just discovered that I can use unix to send mail to a mail address. I normally use entourage for my mail. This unix mail is very intriguing to me, but something is not working... I tried the search, but could not find the answer... This works: (in terminal)... (1 Reply)
Discussion started by: bjorn
1 Replies

7. UNIX for Advanced & Expert Users

aliasing the TO name in Unix mails

HI All, I have a small question/clarification/doubt . Does anyone know how to provide alias in the mails that come from Unix servers. Like i have a Unix server that generates status mails every hour for a scheduled job , it sends me mails with status with the ID in from field as... (3 Replies)
Discussion started by: bsandeep_80
3 Replies

8. UNIX for Dummies Questions & Answers

Receive e-mail on unix box

Hi, I am not sure if it is a good question or not. Is there a unix utility which can be configured with exchange server and then receive e-mails? Thanks! (4 Replies)
Discussion started by: DejaVu
4 Replies

9. UNIX for Dummies Questions & Answers

Steps to configure sendmail to receive e-mails

Hi Unix Gurus, Please help me out here. Please tell me the steps to conigure sendmail to receive emails (same way we configure outlook client in windows)? Thanks in advance. -Dejavu (1 Reply)
Discussion started by: DejaVu
1 Replies

10. Linux

Permissions to receive ftp push from Unix box

Hi all, I am new to this forum, hoping to find the solution to a problem I've been having for days. I have a VPS on Linux box. I have setup an ftp account with the Plesk control panel. I am trying to receive an ftp data push from a Unix box but they tell me they keep getting permission... (2 Replies)
Discussion started by: carriehoff
2 Replies
Login or Register to Ask a Question