That's one way of doing it yes.  I do it slightly different.

All my userid's in dbmail_users are fully qualified ([EMAIL PROTECTED])
Aliases in dbmail_aliases are only if a user requests an alias,
like ([EMAIL PROTECTED] -> niblettda's user_idnr).

Then a forward for the user would be in the aliases table, as in
[EMAIL PROTECTED] -> [EMAIL PROTECTED]

A more complete outlook:

dbmail_users
+-----------+----------------------+
| user_idnr | userid               |
+-----------+----------------------+
| 1002      | [EMAIL PROTECTED] |
| 2356      | [EMAIL PROTECTED]       |
| 5672      | [EMAIL PROTECTED]      |
+-----------+----------------------+

dbmail_aliases
+----------------------+----------------+
| alias                | deliver_to     |
+----------------------+----------------+
| [EMAIL PROTECTED]     | 1002           |
| [EMAIL PROTECTED] | [EMAIL PROTECTED] |
| [EMAIL PROTECTED]       | [EMAIL PROTECTED]  |
| [EMAIL PROTECTED]      | [EMAIL PROTECTED] |
+----------------------+----------------+


So in this above example, if email comes into dbmail for
'[EMAIL PROTECTED]', dbmail will use the SMTP settings
in dbmail.conf to send the Email to [EMAIL PROTECTED]

If email came in for [EMAIL PROTECTED], then it would be
deposited into the 1002 user_idnr account, NOT forwarded.

If email came in for [EMAIL PROTECTED], then SMTP settings
in dbmail.conf are used to send to [EMAIL PROTECTED]

If email came in for [EMAIL PROTECTED], then SMTP settings
used to send message to [EMAIL PROTECTED], which comes BACK
to dbmail and SMTP is used AGAIN to send the message to
[EMAIL PROTECTED]

Mail for [EMAIL PROTECTED] is dumped into user_idnr 5672's
INBOX.


My suggestion is to not use any user_idnr's in dbmail_aliases,
make everything an Email reference.  Then use virtual_alias_maps
in postfix (or your SMTP server of choice), and reference the
dbmail_aliases table.  The SMTP server should sort out before hand
all the requirements of the alias, forward directly from the
SMTP server and never bother dbmail unless deliver is to dbmail.

I believe postfix supports recursive alias lookups so if Email
arrived for [EMAIL PROTECTED], first lookup would get [EMAIL PROTECTED]
which would trigger another lookup to return [EMAIL PROTECTED]  At
that point the SMTP server should automatically relay the message
to gmail, and dbmail never even knew about the mail.

Plus, should something botch up in your SMTP and the alias' were
not being used, dbmail would still cover you should the message
get to it.  It just won't be done in a very efficient manner, IMHO.

--
David A. Niblett               | email: [EMAIL PROTECTED]
Network Administrator          | Phone: (352) 334-3400
Gainesville Regional Utilities | Web: http://www.gru.net/



-----Original Message-----
From: Matt Salerno [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 14, 2005 12:24 PM
To: DBMail mailinglist
Subject: Re: [Dbmail] send mail to alias -> Real Account -> forward


On 6/14/05, Niblett, David A <[EMAIL PROTECTED]> wrote:
> In my tests what happens now is that your inbound Email, hits dbmail, 
> the alias look up says that it has to invoke SMTP to send the message, 
> so it's back to your SMTP server, which then turns around and sends it 
> back to DBMail with the new address, which then, once again, invokes 
> the SMTP to send the message to the forward location.
> 
> If the user_idnr is used in the deliver_to then the message is 
> immediately stored in the database making it much more efficient.
> 
> The only problem I have with the dbmail_aliases table is that there is 
> no DB reference to a user_idnr.  I added a column (called
> user_idnr) in dbmail_aliases, which is a foreign key reference to 
> dbmail_users(user_idnr), and support cascade on delete.
> 
> This way when I get rid of a user, everything goes.  I also then have 
> an easier way to tie them all together.  The down side is that I have 
> broken dbmail-users -a since I can't add an alias now, but I'm working 
> on fixing that.
> 
> --
> David A. Niblett               | email: [EMAIL PROTECTED]
> Network Administrator          | Phone: (352) 334-3400
> Gainesville Regional Utilities | Web: http://www.gru.net/

I think I am followig what you are saying, but correct me if I am wrong.
>From what I understand, every user has to have at least 1 alias pointing to
them.  Here is how I handle the situation.

When I create a user, I create an alias that points to that user.

Added user msalerno user_idnr=122
Added alias [EMAIL PROTECTED] deliver_to 122
Add alias [EMAIL PROTECTED] deliver_to [EMAIL PROTECTED]
etc...
So every alias I add for user msalerno will point back to the
[EMAIL PROTECTED] alias.

If that is how you have your system setup, couldn't you just look up all
aliases for the user with:

Select
*
from
dbmail_aliases
left join dbmail_users
on dbmail_users.userid = dbmail_aliases.deliver_to or dbmail_users.user_idnr
= dbmail_aliases.deliver_to where dbmail_users.userid = '[EMAIL PROTECTED]'

Or did I completely misunderstand what you are saying?
_______________________________________________
Dbmail mailing list
[email protected] https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to