Forum Discussion

James_Richter_1's avatar
James_Richter_1
Icon for Nimbostratus rankNimbostratus
Jan 27, 2010

SMTP routing based on host header

I have to setup SMTP virtual servers for several SMTP servers on the same project. I'd like to use 1 virtual server and route the email based on host header to the correct production/dev/test environments so I don't have to burn a lot of IP addresses. Is there a way to do that with an iRule? Basically mailbox@prod.ne.edu mailbox@test.ne.edu mailbox@dev.ne.edu all use the same IP, but are routed to the correct pool based on the host header? We do the same for http, but I'm not sure how to do it with SMTP.

3 Replies

  • Hi James,

     

    There is a example irule in the samples page regardig SMTP Proxy

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/SMTPProxy.html

     

     

    It can be modified so that it finds the @addre.com and then you shuttle it to a specific pool

     

     

    I hope this helps

     

     

    Bhattman
  • James_Quinby_46's avatar
    James_Quinby_46
    Historic F5 Account
    There's another example of scanning for particular e-mail addresses here:

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&postid=1700&view=topic

     

     

    The thread also points out that the SMTP server needs to start interacting with the sending MTA before a pool switch can be made - MAIL FROM comes after HELO in the SMTP transaction (more info: http://slett.net/spam-filtering-for-mx/smtpintro.html), so a bit of SMTP proxying is going to be necessary in the rule before the message can be released to the proper pool.

     

     

    See also this thread:

     

     

    http://devcentral.f5.com/default.aspx?tabid=53&forumid=5&postid=8410&view=topic

     

     

    ...for another run at the same issue.
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Not that I don't think it can't be done with an iRule, but is there a reason you can't put in a relay (e.g. postfix) in your DMZ to doit for you?

     

     

    H