LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Need help setting up sendmail with virtual accounts (https://www.linuxquestions.org/questions/linux-server-73/need-help-setting-up-sendmail-with-virtual-accounts-784571/)

edderkop 01-25-2010 07:03 AM

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.

Thanks in advance!

edderkop

amonamarth 01-26-2010 01:13 AM

Here is some help
 
EdderKop:

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.

Check this link: http://www.sendmail.org/tips/virtualHosting

darvil 01-26-2010 02:16 AM

Hi EdderKop

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.

edderkop 01-26-2010 03:21 AM

Hi darvil
Quote:

Originally Posted by darvil (Post 3840669)
Hi EdderKop

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.

Thanks for your suggestion! :-)

edderkop 01-26-2010 03:24 AM

Quote:

Originally Posted by amonamarth (Post 3840624)
EdderKop:

Please take this reply as just a direction to look into.

...

Thanks, that's a good starting point. I hope that I'll get this sorted out in the next few days.

edderkop 01-26-2010 08:03 AM

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.

Any ideas?

sneakyimp 01-26-2010 12:36 PM

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.

edderkop 01-27-2010 03:53 AM

Quote:

Originally Posted by sneakyimp (Post 3841268)
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. :rolleyes:

amonamarth 01-27-2010 12:26 PM

procmail
 
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?

amonamarth 01-27-2010 12:29 PM

Make sure you check procmail's site here: http://www.procmail.org/. The mailing-lists are phenomenal, I use them every so often.

edderkop 01-28-2010 02:43 AM

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! :)


All times are GMT -5. The time now is 07:49 PM.