Routing mail to a smart host based on the FROM address

View: New views
4 Messages — Rating Filter:   Alert me  

Routing mail to a smart host based on the FROM address

by Sebastian Lohmeier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I think it is possible for Exim to route e-mails to smart hosts - SMTP
servers it authenticates to with username and password (like if it was a
  client).

When I create a special route for these to-be-routed e-mails, is it
possible to create the route based on the FROM address of the e-mail
messages rather than based on the recipients addresses?

Thanks in advance for your help!

Sebastian

--
## List details at http://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/

Re: Routing mail to a smart host based on the FROM address

by Bugzilla from exim-users@lists.grepular.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sebastian Lohmeier wrote:

> I think it is possible for Exim to route e-mails to smart hosts - SMTP
> servers it authenticates to with username and password (like if it was a
>   client).
>
> When I create a special route for these to-be-routed e-mails, is it
> possible to create the route based on the FROM address of the e-mail
> messages rather than based on the recipients addresses?
>
> Thanks in advance for your help!

Yes. The following router would route any mail with
postmaster@... in the From header to 192.168.0.1

the_router:
   driver      = manualroute
   condition   = ${if eq{${address:$h_From:}}{postmaster@...}}
   transport   = remote_smtp
   route_data  = 192.168.0.1

--
Mike Cardwell - IT Consultant and LAMP developer
Cardwell IT Ltd. (UK Reg'd Company #06920226) http://cardwellit.com/

--
## List details at http://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/

Re: Routing mail to a smart host based on the FROM address

by Heiko Schlittermann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Sebastian,

Sebastian Lohmeier <sebastian@...> (Mi 15 Jul 2009 14:59:41 CEST):
> Hi,
>
> I think it is possible for Exim to route e-mails to smart hosts - SMTP
> servers it authenticates to with username and password (like if it was a
>   client).
>
> When I create a special route for these to-be-routed e-mails, is it
> possible to create the route based on the FROM address of the e-mail
> messages rather than based on the recipients addresses?

You could test something like this¹:

  begin routers:
    ...

    smartest:
        driver = manualroute
        route_data = ${lookup{$sender_address_domain}lsearch*{/etc/exim/routes.by-sender}}
        ...


# cat /etc/exim/routes.by-sender
example1.org: relay.for-example1.org
example2.org: relay.for-example2.org
*:            smart.relay.org


¹) not tested, you should think about the "domains = ..." preconditon, the
position of the router in the list of routers, about the wildcard I
used, about "no_more", and more

    Best regards from Dresden/Germany
    Viele Grüße aus Dresden
    Heiko Schlittermann
--
 SCHLITTERMANN.de ---------------------------- internet & unix support -
 Heiko Schlittermann HS12-RIPE -----------------------------------------
 gnupg encrypted messages are welcome - key ID: 48D0359B ---------------
 gnupg fingerprint: 3061 CFBF 2D88 F034 E8D2  7E92 EE4E AC98 48D0 359B -


--
## List details at http://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/

signature.asc (204 bytes) Download Attachment

Re: Routing mail to a smart host based on the FROM address

by Heiko Schlittermann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Mike Cardwell <exim-users@...> (Mi 15 Jul 2009 15:29:45 CEST):

> Sebastian Lohmeier wrote:
>
> > I think it is possible for Exim to route e-mails to smart hosts - SMTP
> > servers it authenticates to with username and password (like if it was a
> >   client).
> >
> > When I create a special route for these to-be-routed e-mails, is it
> > possible to create the route based on the FROM address of the e-mail
> > messages rather than based on the recipients addresses?
> >
> > Thanks in advance for your help!
>
> Yes. The following router would route any mail with
> postmaster@... in the From header to 192.168.0.1
Hm, I'm not sure, if I would rely on the From-Header or on the
envelope from. Probably on the envelope. Or even more save: on some
authenticated id.

> the_router:
>    driver      = manualroute
>    condition   = ${if eq{${address:$h_From:}}{postmaster@...}}
>    transport   = remote_smtp
>    route_data  = 192.168.0.1

--
Heiko


--
## List details at http://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/

signature.asc (204 bytes) Download Attachment