Need help setting up sendmail with virtual accounts
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Need help setting up sendmail with virtual accounts
Hi all
I am in the unfortunate position to migrate existing mail accounts from a qmail server to sendmail - yes, I know that's crazy but it seems that we absolutely need to deploy sendmail, as it is required by our newsletter program.
To begin with, I don't have the slightest idea how to set up sendmail to deliver incoming mails to virtual accounts. To make this a bit clearer, here's our current directory structure, used by qmail in conjunction with vpopmail:
Code:
/
|__ home/
|__ vpopmail/
|__ domains/
|__ firstdomain.com/
|__ john.doe/
|__ Maildir
|__ cur
|__ new
|__ tmp
|__ joe.bloggs/
|__ Maildir
|__ cur
|__ new
|__ tmp
|__ wilmaflintstone/
|__ Maildir
|__ cur
|__ new
|__ tmp
|__ barny.rubble/
|__ Maildir
|__ cur
|__ new
|__ tmp
|__ seconddomain.com/
|__ fredflintstone
|__ Maildir
|__ cur
|__ new
|__ tmp
|__ bamm-bamm.rubble/
|__ Maildir
|__ cur
|__ new
|__ tmp
|__ seconddomain.org/
|__ ...
|__ seconddomain.net/
|__ ...
|__ thirddomain.org/
|__ ...
|__ ...
That's what I need to set up with sendmail (the exact directory structure isn't important). As for now, incoming mails get moved to a user directory under /home, e.g. /home/johndoe/Maildir.
Can anyone so much as point me in the right direction? What do I need to employ? Can something like that be achieved with procmail? I've googled extensively but I either used the wrong keywords or sendmail is used so rarely nowadays that there really isn't much information available anymore.
Please take this reply as just a direction to look into.
I trust you know the proper way to setup the sendmail configuration file(/etc/mail/sendmail.cf) is to use a macro file first, normally sendmail.mc, and "compile" it(probably not the right terminology) with the "m4" utility.
Well ...
Include this line into your macro file(your ".mc" file): FEATURE(`virtusertable')dnl
This will configure sendmail to look into the virtual users database file, normally found at /etc/mail/virtusertable.db. In this directory there is a similar file named virtusertable, which can be edited. I think you would include virtual users here, once done just run: "makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable" which will append your new entries into the database file.
I'm going to assume you already have the emails created.
What I will suggest for migration is to use imapsync (http://freshmeat.net/projects/imapsync/). Email migration used to be a real PITA for me until I discovered this tool. I have used it to migrate from postfix to qmail, from postfix to zimbra and qmail to zimbra. Best way to do is to install it on another linux server and run some simple commands and everything will get moved. I'm not sure about sendmail (although I think its close to postfix), but postfix had emails all stored in a single file while qmail has it all seperated. Of course none of this is a concern imapsync.
Its the best way I've found. There probably is a better way but I don't know of any so far.
I'm going to assume you already have the emails created.
What I will suggest for migration is to use imapsync
Thanks. I've in fact already worked with imapsync, for a previous migration where we already had to move a small part of our existing email accounts to Zimbra. It really is a very handy tool and once I've set up a working environment with sendmail, I'll certainly use it again to migrate our accounts.
I've been playing around with the virtusertable and the possibilities it provides to map several user names or domains to one account are nice and will certainly come in handy but it's unfortunately still not what I'm looking for (or I am missing something). Is there a possibility to use not actual system accounts to have mail delivered to but subdirectories, as lined out in the directory tree above? So, a mail that is addressed to johndoe@example.com would with my present configuration go to the Maildir in the home directory /home/johndoe (i.e. /home/johndoe/Maildir). With the virtusertable I can configure sendmail in such a way, that mail for, say, johnny.doe@example.com is delivered to johndoe, too. I want, however, to gather all the mailings under one single account called, say, mail. The directory structure I envisage should look something like the following:
Code:
/home/mail/
|__ example.com
|__ johndoe
|__ cur
|__ new
|__ tmp
|__ janedoe
|__ cur
|__ new
|__ tmp
|__ ...
|__ foo.net
|__ ...
|__ ...
I.e. I don't want to have a user account on the mail server's system for every single mail account, but rather the mail accounts represented as subdirectories under /home/mail/domainname/accountname.
If this is proving difficult, perhaps you should consider altering your newsletter program? If it's written in PHP, I might be able to help you figure that out.
If this is proving difficult, perhaps you should consider altering your newsletter program?
I can't tell you how many times I've been phantasizing about such a thing - a nice, easy to administrate, newsletter program that works well together with postfix or any other modern MTA.
Unfortunately my boss won't have it. I begin to wonder, though, if I should not just tell her to forget the whole thing, that it's just not possible to get that trash to work or worth spending any more time on.
Last edited by edderkop; 01-27-2010 at 03:59 AM.
Reason: typo
I wonder if procmail can help you? I know it can be configured to redirect messages to other folders, users, even pipe them through programs. Perhaps a good mix of sendmail virtualuser table and procmail recipes?
Thanks for your suggestion, amonamarth. The use of procmail sounds reasonable and should in fact be feasible if I can parse out the domain and user parts from the recipient address. Fortunately, I've already set up sendmail to use procmail, so that mail is delivered into Maildirs instead of the default mbox format. So, I'd just need to figure out the correct rulesets. I'll look into this next. Thanks!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.