Forum Discussion

Thomas_Walker_1's avatar
Thomas_Walker_1
Historic F5 Account
Jan 06, 2005

Can we use an iRule to dispatch SMTP messages?

I have a request to route mail messages based on the RCPT TO: field. Is there a reliable way in v9 to collect enough of the initial mail transaction so we may read the RCPT TO: portion and send the entire message transaction to a server based on that name? This customer wants to split user communities across several separate machines and use our technology to determine which Oracle messaging server houses the correct users mailbox. Any suggestions? They have already rejected the introduction of a layer of intermediate mail relays - sorry!

 

 

Thanks all!

 

Thom

 

3 Replies

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Thom,

     

    Yes, this type of rule should be feasible. You would use a simple tcp profile and the commands TCP::collect, TCP::payload, TCP::payload replace, and TCP::respond to collect, parse, and modify the SMTP messages.

     

     

    However, the error detection and recovery is going to be the largest and hardest part of the rule. For example, the "MAIL FROM:" command may come before the "RCPT TO:" command. In that case, we would need to supply a fake/proxied response, likely a "250 xxx... Sender ok". However, later when the server has been picked and we are now replaying the initial portion of the connection to the chosen server, we may instead get a "553 xxx... Domain name required" or "501 xxx... Sender domain must exist". There is very little recourse of action at this point, since the clientside of the rule has already responded with the 250. Perhaps just resetting the connection would work here.

     

     

    If anyone out there has the desire to work on this rule, then please post it to DevCentral. Otherwise, we may eventually get a chance to develop this rule and we'll be sure to post it in the Downloads section.

     

     

    Another approach would be to contract through our professional services organization to develop the rule.

     

     

    Hope this helps.
  • Thomas_Walker_1's avatar
    Thomas_Walker_1
    Historic F5 Account
    Thanks! All I really need to show is routing of the message based on the RCPT TO: field. We've advanced to the point where the customer wants a proof of concept and I'd like to persue this further. We can assume for the proof of concept that we will only have a handful of mail accounts to determine and no worries for advanced error handling. Will you clue me in on the basic rule structure? I'm afraid I'm getting pretty confused.
  • Hi,

     

     

    I wonder if you could bother to take a look at my post:
    http://devcentral.f5.com/Default.aspx?tabid=28&forumid=5&postid=8410&view=topic (Click here)
    I think this iRule will do something simular to what you request. What I think could be a problem is that one e-mail transaction can have many RCPT TO: commands which must be routed to separate servers/mailboxes. In our case we are happy if we can loadbalance "right" in 80% of the cases but that might not be your case.

     

     

    Please give me a hint if you have comments, suggestions for better functionality/code etc.

     

     

    Best regards

     

    Terje Gravvold