Hi,
I posted this query a few weeks ago but never received a response. I'm guessing that I didn't put things right, so here is another go.
The company that I work for currently has email addresses in the format of:-
firstname.surname.ext@example.com
Which we use for various marketing campaigns (therefore the .ext bit is variable).
Currently we have this setup as distribution lists with exchange so that any email that goes to this addressess goes both to the sales person and to a catch all mailbox which is then input into our systems.
I was wondering if it would be possible so that when an email is received to this format of address it automatically determines where to send it as follows
An email comes into joe.bloggs.sa...@example.com this then gets split so that it is delivered to joe.blo...@example.com and also s...@example.com.
I think that i have figured out how to rewrite to the second address but how can I get it to send it to the new address as well. I was hoping there would be a way of doing this automatically so that we don't have to setup these addresses for every new starter and they apply on a global basis.
Hopefully that explains better what I am after.
Regards
Lee
My personal opinion is what you want can have in some cases unpredictable results, so I propose you to use only some kind of list managers (as listar for example)
Lee W wrote:
Hi,
I posted this query a few weeks ago but never received a response. I'm guessing that I didn't put things right, so here is another go.
The company that I work for currently has email addresses in the format of:-
firstname.surname.ext@example.com
Which we use for various marketing campaigns (therefore the .ext bit is variable).
Currently we have this setup as distribution lists with exchange so that any email that goes to this addressess goes both to the sales person and to a catch all mailbox which is then input into our systems.
I was wondering if it would be possible so that when an email is received to this format of address it automatically determines where to send it as follows
An email comes into joe.bloggs.sa...@example.com this then gets split so that it is delivered to joe.blo...@example.com and also s...@example.com.
I think that i have figured out how to rewrite to the second address but how can I get it to send it to the new address as well. I was hoping there would be a way of doing this automatically so that we don't have to setup these addresses for every new starter and they apply on a global basis.
Hopefully that explains better what I am after.
Regards
Lee _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Romeo Ninov wrote:
My personal opinion is what you want can have in some cases unpredictable results, so I propose you to use only some kind of list managers (as listar for example)
Lee W wrote:
Hi,
I posted this query a few weeks ago but never received a response. I'm guessing that I didn't put things right, so here is another go.
The company that I work for currently has email addresses in the format of:-
firstname.surname.ext@example.com
Which we use for various marketing campaigns (therefore the .ext bit is variable).
Currently we have this setup as distribution lists with exchange so that any email that goes to this addressess goes both to the sales person and to a catch all mailbox which is then input into our systems.
Thanks for the suggestion Romeo, although I'm not really sure it that would be any better than the way we currently do it as it would still require manual configuration and that is what i'm trying to get away from.
I'm guessing that exim can probably do this using regular expression matching but unfortunately the server doesn't have this installed and my boss doesn't want anything new on the box (an old RH7.3 machine).
If you want to do it automagically rather than having a bucket load of aliases and virtusertable entries have you considered "procmail" ?
You can have a global procmail setting for all emails delivered to the particular box, then use procmail expressions to grep out and redliver what you need.
Martin Mcarthy has written an excellent book on Procmail which you may find useful if you go down this route, alternatively you can google for procmail answers too!
http://www.amazon.co.uk/exec/obidos/ASIN/0201737906/ref=ase_easternhabitat0b...
P.
Lee W wrote:
Romeo Ninov wrote:
My personal opinion is what you want can have in some cases unpredictable results, so I propose you to use only some kind of list managers (as listar for example)
Lee W wrote:
Hi,
I posted this query a few weeks ago but never received a response. I'm guessing that I didn't put things right, so here is another go.
The company that I work for currently has email addresses in the format of:-
firstname.surname.ext@example.com
Which we use for various marketing campaigns (therefore the .ext bit is variable).
Currently we have this setup as distribution lists with exchange so that any email that goes to this addressess goes both to the sales person and to a catch all mailbox which is then input into our systems.
Thanks for the suggestion Romeo, although I'm not really sure it that would be any better than the way we currently do it as it would still require manual configuration and that is what i'm trying to get away from.
I'm guessing that exim can probably do this using regular expression matching but unfortunately the server doesn't have this installed and my boss doesn't want anything new on the box (an old RH7.3 machine).
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Peter Farrow wrote:
If you want to do it automagically rather than having a bucket load of aliases and virtusertable entries have you considered "procmail" ?
You can have a global procmail setting for all emails delivered to the particular box, then use procmail expressions to grep out and redliver what you need.
Martin Mcarthy has written an excellent book on Procmail which you may find useful if you go down this route, alternatively you can google for procmail answers too!
http://www.amazon.co.uk/exec/obidos/ASIN/0201737906/ref=ase_easternhabitat0b...
P.
Thanks Peter,
I guess it would be possible to have sendmail check for this format of address and then use this to set which mailer to use, in which case I could define a new procmail mailer.
Regards
Lee
To deliver joe.bloggs.sa...@example.com to joe.blo...@example.com and s....@example.com do this:
in /etc/mail/local-host-names:
example.com
in
/etc/mail/virtusertable
joe.bloggs.sa.....@example.com joe.bloggs s....@example.com alternate-email-address-or-username-on-this-box-of-"s....@example.com"
in /etc/aliases
joe.bloggs: joebloggs-mailbox-name-here-or-other-email-address, s....@example.com
you can combine the virtusertable entry and the alias part for the s....@example.com into one entry... as follows if you prefer
remove the s....@example.com alternate-email-address-or-username-on-this-box-of-"s....@example.com" from /etc/mail.virtusertable
and modify /etc/aliases line as follows:
joe.bloggs: joebloggs-mailbox-name-here-or-other-email-address, alternate-email-address-or-username-on-this-box-of-"s....@example.com"
if you want a catchall,
in /etc/mail/virtusertable
@example.com catchall-alias-name-username-or-alternate-email-address
if you want to re-write
in /etc/mail/virtusertable
@somewhereelse.com %1@example.com
but in this latter case somewhereelse.com must be listed in /etc/mail/local-host-names as well.
Hope this gives you a starting point
Pete
Romeo Ninov wrote:
My personal opinion is what you want can have in some cases unpredictable results, so I propose you to use only some kind of list managers (as listar for example)
Lee W wrote:
Hi,
I posted this query a few weeks ago but never received a response. I'm guessing that I didn't put things right, so here is another go.
The company that I work for currently has email addresses in the format of:-
firstname.surname.ext@example.com
Which we use for various marketing campaigns (therefore the .ext bit is variable).
Currently we have this setup as distribution lists with exchange so that any email that goes to this addressess goes both to the sales person and to a catch all mailbox which is then input into our systems.
I was wondering if it would be possible so that when an email is received to this format of address it automatically determines where to send it as follows
An email comes into joe.bloggs.sa...@example.com this then gets split so that it is delivered to joe.blo...@example.com and also s...@example.com.
I think that i have figured out how to rewrite to the second address but how can I get it to send it to the new address as well. I was hoping there would be a way of doing this automatically so that we don't have to setup these addresses for every new starter and they apply on a global basis.
Hopefully that explains better what I am after.
Regards
Lee _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
additional note as per my last response
/etc/mail/access must include
example.com RELAY somewhereelse.com RELAY
P.
Romeo Ninov wrote:
My personal opinion is what you want can have in some cases unpredictable results, so I propose you to use only some kind of list managers (as listar for example)
Lee W wrote:
Hi,
I posted this query a few weeks ago but never received a response. I'm guessing that I didn't put things right, so here is another go.
The company that I work for currently has email addresses in the format of:-
firstname.surname.ext@example.com
Which we use for various marketing campaigns (therefore the .ext bit is variable).
Currently we have this setup as distribution lists with exchange so that any email that goes to this addressess goes both to the sales person and to a catch all mailbox which is then input into our systems.
I was wondering if it would be possible so that when an email is received to this format of address it automatically determines where to send it as follows
An email comes into joe.bloggs.sa...@example.com this then gets split so that it is delivered to joe.blo...@example.com and also s...@example.com.
I think that i have figured out how to rewrite to the second address but how can I get it to send it to the new address as well. I was hoping there would be a way of doing this automatically so that we don't have to setup these addresses for every new starter and they apply on a global basis.
Hopefully that explains better what I am after.
Regards
Lee _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
You can duplicate emails by extensive use of the /etc/mail/aliases
For example:
in /etc/mail/virtusertable
joe.bloggs@example.com aliasenamehere
in /etc/aliases
aliasenamehere: emailaddress1, emailaddress2, usrename1, username2
You can even have overlapping alias and usernames if you want to, the alias takes precedence
for example: in /etc/mail/virtusertable
joe.bloggs@example.com joebloggs
in /etc/aliases
joebloggs: joebloggs, emailaddress2, usrename1, username2
In this second example the joebloggs in the virtusertable is interpreted as the alias by sendmail In /etc/aliases, the "joebloggs:" part is interpreted as the alias referred to by the virtusertable and the "joebloggs," is interpreted as the username
Regards
Pete
Romeo Ninov wrote:
My personal opinion is what you want can have in some cases unpredictable results, so I propose you to use only some kind of list managers (as listar for example)
Lee W wrote:
Hi,
I posted this query a few weeks ago but never received a response. I'm guessing that I didn't put things right, so here is another go.
The company that I work for currently has email addresses in the format of:-
firstname.surname.ext@example.com
Which we use for various marketing campaigns (therefore the .ext bit is variable).
Currently we have this setup as distribution lists with exchange so that any email that goes to this addressess goes both to the sales person and to a catch all mailbox which is then input into our systems.
I was wondering if it would be possible so that when an email is received to this format of address it automatically determines where to send it as follows
An email comes into joe.bloggs.sa...@example.com this then gets split so that it is delivered to joe.blo...@example.com and also s...@example.com.
I think that i have figured out how to rewrite to the second address but how can I get it to send it to the new address as well. I was hoping there would be a way of doing this automatically so that we don't have to setup these addresses for every new starter and they apply on a global basis.
Hopefully that explains better what I am after.
Regards
Lee _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Am Sa, den 14.05.2005 schrieb Lee W um 11:28:
An email comes into joe.bloggs.sa...@example.com this then gets split so that it is delivered to joe.blo...@example.com and also s...@example.com.
I think that i have figured out how to rewrite to the second address but how can I get it to send it to the new address as well. I was hoping there would be a way of doing this automatically so that we don't have to setup these addresses for every new starter and they apply on a global basis.
Lee
I suggest you are working with plussed addresses. To be specific an example would be
john.doe+event1@foo.com
You are then able to use the parts as follows:
%1@foo.com == john.doe@foo.com %2@foo.com == event1@foo.com [%3 == +event1]
Alexander
Lee W wrote:
An email comes into joe.bloggs.sa...@example.com this then gets split so that it is delivered to joe.blo...@example.com and also s...@example.com.
You can attempt playing with plussed addresses, so that you use joe.bloggs+campain@example.com. Look for description of virtusertable feature in /usr/share/docs/sendmail/README.cf (part of sendmail-doc package, if you don't have it, install it). Combine it with aliases, and you can acomplish what you need to do.
Another posibility, if you want to automate everything, so that you don't need to configure new setup for each and every campain, would be to write Milter based filter for sendmail. Than you can do all kinds of fancy stuff.
You can find some basic documentation about Milter in /usr/share/docs/sendmail/README.libmilter (with source code of example filter). If you want to write programs using the library, you'll need full API documentation. Unfortunately it is not included with sendmail-doc package. Download Sendmail source from www.sendmail.org, and you'll find documentation in HTML format there.
This is how you would implement it using the filter:
Register callbacks for RCPT command and EOM (end of message). You need callback for RCPT so that your filter is called each time sendmail detects RCPT command (new recipient specification). You need EOM callback, since only in EOM callback function list of recipients can be altered.
Now, if in RCPT callback you detect email address of format first.last.campain@example.com (or first.last+campain@example.com, I would prefer this format), add it to the list stored in private data structure (the one you registered with smfi_setpriv() function). Make sure you are creating per-messeage private data structures inside global per-connection structure (there may be more than one email delivered in single connection).
Then in EOM callback, change the list of recipients so that you add first.last@example.com and campain@example.com, and then if operation was successfull remove first.last.campain@example.com from the list of recipients. Dealocate per-message private data structure and free allocate memory. You should be carefull in this step. You don't want to add non-existing addresses, or do this for non-existing campains, and so on...
You should also have abort callback, that would do cleanup in case message is aborted somewhere in the middle, before EOM callback was called (dealocate private data structure and free memory). And of course a callback for close to clean up global per-connection pointers (smfi_setpriv(ctx, NULL) followed by free() to dealocate memory back to the system).
Don't forget that Milter based filters are multithreaded applications, and care should be taken when writing them.
If you don't feel comfortable programming something like this, hire an experienced programmer. For somebody with experience with Milter API, it should take about hour or two to write simple filter like this and have it fully debugged (provided you give correct specifications of job to the programmer). No, I'm not going to do it for a fee, I already have too many other (more fun) things to do ;-)
Of course, you don't need to use C to write a filter. There are good Perl modules that allow you to write filters in Perl too.