[Exim] Rewriting based on to: address

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Josha Foust
Datum:  
To: exim-users
Betreff: [Exim] Rewriting based on to: address
I am trying to create virtual addresses for users on my system, so that they
can have different email addresses depending on who they are corresponding
with. The idea is that when an email comes in from outside, I do a database
lookup, to see who it I should send it to (or bounce it). This is easy enough
with an alias directive... However, I would also like to rewrite the from
address when users are sending mails, based on who it is to. To do these two
things, I thought of the following:

Main:

mysql_servers = "localhost/mail/exim/password"

Director:

mysql_system_aliases:
driver = aliasfile
file_transport = address_file
pipe_transport = address_pipe
search_type = mysql
query = "select userid from incoming where aliasid = '$local_part'"
user = exim

Rewrite:

real_email@???    ${lookup mysql{select userid from outgoing where to='$h_to:'}{$value}fail} rsfF


# real_email@??? will probably need to be a lookup to see who is using
this system...

Now I haven't tested this, and would like to know if that would work. There
are also a few other things I would like to do that don't know how to. The
other part of this system is going to be a web driven interface to the
database, so that users can create their aliases and information on who
that alias will be communicating with. But there could be conflicts, or no
alias to use for a certain email (or whatever) that causes me to need to
freeze the outgoing email and send a message back saying there is a conflict,
and then unfreeze it when that conflict has been fixed. So how would I manage
that? I could write external programs to do some of it, but would need to know
how to hook it into the config...

The last part of this system is that I would like the actual userid' accounts
to be invisible from the outside. I.E. you can't send email to them directly,
it all goes through my alias system, but they get all their mail delivered to
that account.

Thanks,
Josha Foust