Re: [exim] My first exim configuration

Top Page
Delete this message
Reply to this message
Author: Maxi Cooper - EGS
Date:  
To: Users Users
Subject: Re: [exim] My first exim configuration
Hi all. This is simply to share with you how I resolved this, just in case
this will sit somewhere in the web. What I was looking for where system
filters, and one like this did the trick:

if $h_To: contains "A@???"
then
        headers remove "From"
        headers add "From: orders@domainA"
        headers remove "To"
        headers add "To: $h_Cc"
        headers remove "Cc"
endif


Thanks to all for your time and best regards.

Maxi Cooper
*EGS* | Gestionamos pedidos.
Tel.: 11 5917 2513 | 15 4070 6215
egsolus.com.ar


2014-01-30 12:51 GMT-03:00 Ian Eiloart <iane@???>:

> Hi Maxi
>
> The rewrite rules don’t work that way. See
> http://www.exim.org/exim-html-current/doc/html/spec_html/ch-address_rewriting.html
>
> Your rewrite rule should have three elements: pattern, replacement, flags.
> You’ll want it to look something like this, but note that I haven’t tested
> it:
>
> This will rewrite the address in the From header and the envelope 'Mail
> from' field:
>         maxi@??? orders@domainA fF

>
> This will rewrite the address in the To header, and the envelope RCPT To:
> field, at SMTP time (so it’s correctly routed):
>         A@??? someone@SomeDomain tTS

>
> But, rewrite rules won’t replace the text description. And, you can’t
> limit these rules to only emails that match both sender and recipient. All
> emails from maxi@??? will be rewritten. Why is the description
> a repeat of the address? That’s ugly, and causes problems with some email
> clients (Apple Mail). Can’t you configure this properly?
>
> Anyway, I don’t think the rewrite rules will do what you wish. Instead,
> you should create a special router, using "senders", "domains" and
> "local_parts" tests, and "headers_add" and "headers_remove". Something like
> this, again untested.
>
> orders:
>    senders = maxi@???
>    local_parts = A
>    domains = egsolus.com.ar
>    headers_remove = To, CC
>    headers_add = To: $h_cc
>    address_data = ${addresses:>, $h_cc}

>
> This should work even if there are multiple addresses in the CC field.
> But, I presume that if you’re redirecting an email from Gmail, the CC
> recipients will already have had a copy.
>
> On 28 Jan 2014, at 23:47, Maxi Cooper - EGS <maxi@???> wrote:
>
> > Sicerely appreciate all your help here folks. Point taken regarding the
> > domains, won't use them again, sorry!
> >
> > So I was pretty much on the right track, but unsecure because of my lack
> of
> > knowledge. After some coming and going, I finally managed to make a
> *begin
> > rewrite* rule to work, but stil can't see how to acheive my goal. For
> > example, if I generate an email from Google Apps *From:* *
> maxi@???
> > <maxi@???>* *To:* *A@??? <A@???>* with
> *CC*
> > *someone@SomeDomain,* I need my exim server to send just one email
> *From:
> > orders@domainA to someone@SomeDomain*
> >
> > Different rules I applied allowed me to change some address for something
> > else, but always within the same header. I also found that you can do
> some
> > conditional writing, but can't manage to write something that works.
> >
> > Rule should be something like:
> > if mail is addressed to *A@??? <A@???> *
> > rewrite *From* to *orders@domainA* and
> > rewrite *To* whoever is in Cc (in the example, someone@SomeDomain)
> >
> > I tried something like this, which I know it has many limitations, but
> > still didn't work:
> >
> >
> > begin rewrite
> >
> > ^maxi@??? "${if eq {$header_to}{A@???}
> {orders@domainA
> > }{orders2@domainA}}" SFf      #this won't resolve the if. If I manually
> > code *orders@domainA* it will work, but here I need to tell A from B
> from
> > C, etc. by nesting ifs or in some other way

> >
> > ^A@??? $header_cc STt    # this is working ok for domain A, I
> > guess I could just use an *
> > # I'm still missing how to remove all the other Cc and Bcc

> >
> >
> > Any suggestions?
> >
> > Maxi Cooper
> > *EGS* | Gestionamos pedidos.
> > Tel.: 11 5917 2513 | 15 4070 6215
> > egsolus.com.ar
> >
> >
> > 2014-01-25 Jasen Betts <jasen@???>
> >
> >> On 2014-01-23, Maxi Cooper - EGS <maxi@???> wrote:
> >>> Hi all. My name is Maxi and this is the first time I have to do some
> work
> >>> around a MTA.
> >>>
> >>> I use as a primary email server my Google Apps account, but I need to
> >>> achieve something very specifiy which I cannot do with them.
> Therefore, I
> >>> configured Google Apps to route certain specific emails throught my
> >> server
> >>> instead of theirs. At this point I managed to send an email from a
> Google
> >>> Groups, route it to my VPS (without SMTP auth) and have exim process it
> >> and
> >>> send it.
> >>>
> >>> Now I need to modify the "From" and "Cc" and I'm lost on how to start.
> >> Been
> >>> browsing for hours but I'm obviously lacking the basics. Emails sent
> from
> >>> Google Groups come with the following headers:
> >>
> >>> From: group_name@???
> >>> To: group_name@???
> >>> Cc: some@??? (the actual legitimate destinatary of the message)
> >>
> >> email.com and domain.com probably don't like others using their domain
> >> names
> >> in examples.
> >>
> >>> and I need them to be:
> >>>
> >>> From: another@??? (a different domain which I own and manage
> from
> >>> this VPS)
> >>> To: some@???
> >>> Bcc: group_name@???
> >>>
> >>> So, is this possible to achive? If so, could someone please point me in
> >> the
> >>> right direction on how to address this?
> >>
> >>
> >> It looks like all you need to do is
> >> copy the Cc: content to To:, and drop the Cc: header entirely
> >> Also rewrite the from, but what about envelope sender?
> >> Bcc isn't a header.
> >>
> >>
> >> --
> >> For a good time: install ntp
> >>
> >> --
> >> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> >> ## Exim details at http://www.exim.org/
> >> ## Please use the Wiki with this list - http://wiki.exim.org/
> >>
> > --
> > ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> > ## Exim details at http://www.exim.org/
> > ## Please use the Wiki with this list - http://wiki.exim.org/
>
> --
> Ian Eiloart
> Postmaster, University of Sussex
> +44 (0) 1273 87-3148
>
>