1 to four mail boxes (True or False)?

I just want to know if it is really possible:

My network provider give me one mail box and allow me to define 3 aliases to this mail box. For instance, the email account is info@mydomain.com, I can have three aliases (staff1@mydomain.com, staff2@mydomain.com, staff3@mydomain.com) to the same mail box. As a result, when I login to the smtp.mydomain.com with "info", I can get all message from these four email addresses.

Question: Can I use fetchmail and sendmail to download all messages to my local mail system, and let four users to get their messages from this mail box individually? User should login local mail server as info, staff1, staff2, staff3.

(Is it called masquerading from the sendmail handbook?)

I would be very happy to give more point for someone give me more tips to do this. Thank you very much.
Who is Participating?
Yeah but you still haven't specified the localdomains line have you?
Also as for point 4 of no relaying you can solve that using the relay-domains file to allow your local network or your domain to relay through your mail server.
I will give you an example of how what I said works if it applies to you then take it up
I have a client with his domain as client.domain.name his mx records point to my.server.name and I have an account on my box called client into which I direct all this mail.
So he gives people e-mail accounts at client.domain.name say user1@client.domain.name user2@client.domain.name etc and all this goes to that one mail box called client on my box then he he has a .fetchmailrc file which he runs as root that reads
poll myserver protocol pop3 nodns
localdomains client.domain.name host.client.domain.name
user username pass passwd to
and his sendmail.cf has a line specifying that client.domain.name is a local domain i.e
when he runs fetchmail -va the mail is delivered to user1 user2 etc's mail boxes also there should be an entry in etc/hosts for client.domain.name.If this is the kind of setup you have then it should work if you set it up this way.
if your mail server is called mydomain.com then you just simply have to create those accounts as they are and then when you run fetchmail sendmail will send this mail to the individual mail boxes.
If not then define a Cw in your sendmail.cf file defining mydomain.com as a a domain local to your host.
then your .fetchmailrc would look like this
poll isp.com protocol pop3 nodns
localdomains mydomain.com
user (account) pass (passwd) to
I hope this is what you wanted
If I remember correctly from when I was doing this (many moons ago - run my own mail servers these days), you can indeed do this with fetchmail/sendmail.

In your /etc/aliases file, you will need to add some lines like :

info@mydomain.com: info
staff1@mydomain.com: staff1
staff2@mydomain.com: staff2
staff3@mydomain.com: staff3

Save the file, and execute the "newaliases" command.

Create the user accounts for info, staff1, staff2, and staff3 - these are what your staff will log into to collect their mail from your local server.

Have fetchmail poll the POP3 server at your ISP.  As the messages come in, and are passed to sendmail, those messages addressed to the staffx@ addresses should be moved to the correct mail folders during the processing.

Like I say, it's been a little while since I did this, but I'm 99% sure that's all I did.

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

akitAuthor Commented:
Thanks a lot.

My local mail server name is now change to mydomain.com and aliases are added, send & receive messages locally are okay but all remote messages by fetchmail are send to root's mailbox.
akitAuthor Commented:
Adjusted points from 5 to 50
akitAuthor Commented:
I still work/try on it these hours. :(
I nearly send hundred of mail to myself :<

However, all message only send to root's mailbox..!  %[

I looked a Sendmail reference book, it said that there is a /etc/virtusertable like /etc/aliases file, I thank it may help but I don't know how to make sendmail to read it.

The book only said that I must add the "virtusertable" feature to the macro file:

FEATURE('virtusertable', 'hash /etc/virtusertable')

WHAT's THAT? Thanks.
akitAuthor Commented:
So tried and sleep now.. Hope to have someone give me any hints.. Thanks..
akitAuthor Commented:
.Should I use "MultiDrop" feature on fetchmail??
The virtusertable is used when you want to direct that mail that comes for user x should go to account y and also to say that mail addressed to domain y should go to account z lets  say I p has a domain test.domain.com but he is not on the net full time then I can set him up in my virtusetable like this
@test.domain.com  test and add a Cwtest.domain.com to my sendmail.cf file this will direct all mail that comes to anyone at test .domain.com to the account test on my machine and thus they can poll that account and fetch their mail same with
user@test.domain.com test will direct mail to user@test.domain.com to the account test.
Now as for putting all the mail in root's account, make sure there is an entry for my.domain.com in your /etc/hosts file then you should have a localdomains line specifying that my.domain.com is a local domain
localdomains my.domain.com host.mydomain.com
where host is the host name of your box.
akitAuthor Commented:
Still not work, my root mailbox full of testing messages...
May I clarify my need and situation:

1. My ISP host my domain, web address is www.mydoamin.com, mail server is mail.mydomain.com (SMTP and POP3).

2. My ISP only give me one mail login ID (info) and password (one mail box), but allow me to set three aliases to this mail box (staff1, staff2 and staff3).

3. There are four users account in my local linux box: info, staff1, staff2, staff3. The linux box host name is "fs1" and domain is "office" (fs1.office). Sendmail is working locally for any message send to @fs1 or @mydomain.com.

4. I can't send email outside the world, the local smtp say "we do not relay..."

5. I put following to the /etc/aliases and executed newaliases:
info@mydomain.com info
staff1@mydomain.com staff1
staff2@mydomain.com staff2
staff3@mydomain.com staff3

6. I removed all entries in virtusertable and makemap again

7. My fetchmailrc is simply as below:
set postmaster "postmaster"
set bouncemail
set properties ""
set daemon 1
poll mail.mydomain.com with proto POP3 nodns
       user info there with password PASSWORD is * here options
keep no rewrite

8. My /etc/hosts file is as below:   fs1.office   fs1
localdomains  mydomain.com  fs1.office

9. I don't have static IP, but eth0 can connect to the internet by the gateway device.

What is my fault?? Please help. Really thank you very much.
Since the ISP has simply created aliases for a single email account all of the email to the various accounts (info, staff1, staff2, etc.) is being delivered to that account at the ISP. When you fetch the mail from the ISP it is all going into root's mailbox as you are undoutedly running fetchmail as root. You can tell fetchmail to put the messages into some other mailbox, but they will still all go to a single mailbox.

Depending on what the headers of the email look like, it might or might not be possible to separate the stream of messages into separate streams to be sent to various local user mailboxes with procmail. The orginal "To:" header that has the aliased account name must be present to be able to separate the messages.

What you need is not a single mailbox at the ISP and multiple aliases, but multiple mailboxes, each with a separate username. Many ISP's will do this for a modest monthly charge. Then you have a way of unambiguously telling your system where the various messages are to go to.
akitAuthor Commented:
The header is like below:
Delivered-to: mydomain.com%info@mydomain.com
Delivered-to: mydomain.com%Staff1@mydomain.com
To: <staff1@mydomain.com>

The "To:" header is showing the aliase, in this case, is it possible for me to deliver the message to staff1's mailbox?

I need to have 50 mail addresses for users, each mailbox cost me US$30, if I can make it one to four, that would be saved much money.

Please teach me. Thank you very much.
Yes, I believe a procmail rule can be used to separate out the messages, and it should work for any number of aliases in one mailbox. It's entirely too lat to work up and test the procmail rule tonight, but I think I can have something for you tomorrow. In the meantime you could look at the man pages for procmail and procmailex any play with the concept yourself.
so in your case I guess you can have a .fetchmailrc like this
poll mydomain.com protocol pop3 nodns
localdomains mydomain.com host.mydomain.com
user info pass passwd to
and add this to sendmail.cf
also edit hosts and add
192.x.x.x mydomain.com mydomain
then create user accounts for user1 user2 etc and remove all those aliases you set up.
run fetchmail -va and ti should work.I hope.
akitAuthor Commented:
Follow with ksemat, the fetchmail work excellent.

The points will be given soon, just because I have another question about "551 we do not relay" under this situation, I want to leave this open for a moment, in case someone need to know my setting details. Thanks.

ksemat, jlevie and ibishop, would you pls join my question at:


Many thanks.
akitAuthor Commented:
Comment accepted as answer
akitAuthor Commented:
Excellent! Thank you very much!
it is good that your problem was solved but it apeears that your other question is already answered and I have to surrender two points to see the answer and maybe add a suggestion maybe if you remove that I will be able to provide more input.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.