Link to home
Start Free TrialLog in
Avatar of akit
akit

asked on

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.
Avatar of ksemat
ksemat

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
root
*
here
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.

Ian
Avatar of akit

ASKER

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.
Avatar of akit

ASKER

Adjusted points from 5 to 50
Avatar of akit

ASKER

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.
Avatar of akit

ASKER

So tried and sleep now.. Hope to have someone give me any hints.. Thanks..
Avatar of akit

ASKER

.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.
Avatar of akit

ASKER

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:
192.168.0.1   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.
Avatar of akit

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of ksemat
ksemat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
root
*
here
and add this to sendmail.cf
Cwmydomain.com
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.
Avatar of akit

ASKER

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:

http://www1.experts-exchange.com/questions/10354734/551-we-do-not-relay.html

Many thanks.
Avatar of akit

ASKER

Comment accepted as answer
Avatar of akit

ASKER

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.