Forum Discussion

GeneUWG_150657's avatar
GeneUWG_150657
Icon for Nimbostratus rankNimbostratus
Aug 17, 2016

iRule to edit email body

I am using the iApp from https://devcentral.f5.com/wiki/iApp.SMTP-iApp-Template.ashx per the deployment guide at https://www.f5.com/pdf/deployment-guides/f5-smtp-dg.pdf and want to add in an iRule to fix a URL in the body of some emails. Here's my scenario:

 

  1. email comes into F5
  2. iRule checks if from 10.10.0.25
  3. if no, send on to smtp pool. if yes, go to 4
  4. check for the hostname.ad.example.com in the body. if found, replace with service.example.com. This string would be in the form of a URL such as https://hostname.ad.example.com/path/to/some/random/page.htm
  5. send message to pool

I've read up on iRules related to streams and some that use other methods and am just not sure what the best course of action is. Thanks in advance for the help!

 

1 Reply

  • Maybe something like this:

    when CLIENT_ACCEPTED {
        if { not [IP::addr [IP::client_addr] equals 10.10.0.25] } {
            STREAM::expression "@://hostname.ad.example.com@://service.example.com@"
            STREAM::enable
        }
    }