Results 1 to 4 of 4

Thread: Exim with complex forwarding issue

  1. #1
    Join Date
    Nov 2008
    Posts
    109

    Exim with complex forwarding issue

    I have a client that has several users that use BlackBerry units to read their email. I have worked out the delivery of the mail to the BlackBerry users via a router that mirrors the system aliases, as most blackberry webclient accounts only allow for 10MB of storage, I have also placed a Condition Statement to test if the message is over 1MB. Here is my Router
    Code:
     blackberry_aliases:
      driver = redirect
      allow_fail
      allow_defer
      condition = ${if <{$message_size}{1000000}{1}{0}}}
      data = ${lookup{$local_part}lsearch{/etc/blackberry.aliases}}
      headers_add = X-added-header: added by BlackBerry Forward\n
      user = exim
      unseen
      file_transport = address_file
      pipe_transport = address_pipe
    The headers_add is just for testing and will be removed.

    This works perfectly, But The client wants to be notified that a message did not get sent to the BlackBerry due to the size limt, so they can look for the skiped message on the Corporate server. Seems resonable to me. At first I thought that I could just add to my exsisting Routers to test if it was oversized, so I added a new Router:
    Code:
    # BlackBerry Router over sized message:
    blackberry_notify:
      driver = redirect
      allow_fail
      allow_defer
      condition = ${if <{$message_size}{1000000}{0}{1}}}
      data = ${lookup{$local_part}lsearch{/etc/blackberry.aliases}}
      headers_add = X-BlackBerry-oversize: Too Large\n
      user = exim
      allow_filter
      unseen
      no_verify
      file_transport = address_file
      reply_transport = address_reply
    Then in the system filter I added a check for the new header. But Now I've learned that the System filter does not look at the redirected message. I guess I could just process this filter code via a secondary "user" filter. My Current System Filter looks like this:
    Code:
    # Exim filter
    
    headers add "X-Been-Filter: This message has been to the filter"
    
    if "${if def:header_X-New-Subject: {there}}" is there
    then
       headers remove Subject
       headers add "Subject: $h_X-New-Subject:"
       headers remove X-New-Subject
    endif
    if "${if def:header_X-BlackBerry-oversize: {there}}" is there
    then
       mail to $header_to
            from $header_from
            reply_to $header_reply-to
            subject $header_subject
            text "\
            The message sent by $h_from was too large to deliver to your\n\
            blackberry ( size = $message_size )\n\
    "
    endif
    finish
    The first if statement is unrelated to the current issue.
    My question is where do I define the user filter given my current router If I were to defind a separate filter with just the second conditon in it? Can any one suggest a better method to send the notification out to the blackberry alias when the message is over sized?

    Thanks for any help you can provide.

  2. #2
    Join Date
    Nov 2008
    Posts
    109

    Re: Exim with complex forwarding issue

    [QUOTE=Mentos;4242626]I have a client that has several users that use BlackBerry units to read their email. I have worked out the delivery of the mail to the BlackBerry users via a router that mirrors the system aliases, as most blackberry webclient accounts only allow for 10MB of storage, I have also placed a Condition Statement to test if the message is over 1MB. Here is my Router
    Code:
     blackberry_aliases:
      driver = redirect
      allow_fail
      allow_defer
      condition = ${if <{$message_size}{1000000}{1}{0}}}
      data = ${lookup{$local_part}lsearch{/etc/blackberry.aliases}}
      headers_add = X-added-header: added by BlackBerry Forward\n
      user = exim
      unseen
      file_transport = address_file
      pipe_transport = address_pipe
    The headers_add is just for testing and will be removed.

    This works perfectly, But The client wants to be notified that a message did not get sent to the BlackBerry due to the size limt, so they can look for the skiped message on the Corporate server. Seems resonable to me. At first I thought that I could just add to my exsisting Routers to test if it was oversized, so I added a new Router:
    Code:
    # BlackBerry Router over sized message:
    blackberry_notify:
      driver = redirect
      allow_fail
      allow_defer
      condition = ${if <{$message_size}{1000000}{0}{1}}}
      data = ${lookup{$local_part}lsearch{/etc/blackberry.aliases}}
      headers_add = X-BlackBerry-oversize: Too Large\n
      user = exim
      allow_filter
      unseen
      no_verify
      file_transport = address_file
      reply_transport = address_reply
    I have changed the over sized router to the folloing to allow fro a separate filter
    Code:
    blackberry_notify:
      driver = redirect
      allow_fail
      allow_defer
      condition = ${if >{$message_size}{1M}{0}{1}}
      data = ${lookup{$local_part}lsearch{/etc/blackberry.aliases}}
      headers_add = X-BlackBerry-oversize: Message was too large to deliver to BlackBerry\n
      user = exim
      unseen
      no_verify
      redirect_router = blackberry_oversize
    and I have added the following redirect router below the local user router
    Code:
    blackberry_oversize:
            driver = redirect
            unseen
            no_verify
            user=exim
            allow_filter
            file = /etc/mail/exim-blackberry.filter
    The exim-blackberry.filter looks line this
    Code:
    # Exim filter
    
    if "${if def:header_X-BlackBerry-oversize: {there}}" is there
    then
       mail to $header_to
            from $header_from
            reply_to $header_reply-to
            subject $header_subject
            text "\
            The message sent by $h_from was too large to deliver to your\n\
            blackberry ( size = $message_size )\n\
    "
    endif
    seen finish
    Now the issue seems to be when the process comes back from this filter the debug output says transport:

    Below is the last output of the exim run as it considers the resolved addess aquired by the alias look up in the "oversized" router the domain is a remote mail server but I have XXXX ed out the domain. mail can be sent to this address directly so it is not a "general" routing issue.
    Code:
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Considering kbarrett@xxxxx.com
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    routing kbarrett@xxxxx.com
    --------> blackberry_oversize router <--------
    local_part=kbarrett domain=xxxxx.com
    calling blackberry_oversize router
    rda_interpret (file): /etc/mail/exim-blackberry.filter
    expanded: /etc/mail/exim-blackberry.filter
    changed uid/gid: blackberry_oversize router (recipient is kbarrett@xxxxx.com)
      uid=509 gid=510 pid=8192
      auxiliary group list: 
    467 bytes read from /etc/mail/exim-blackberry.filter
    data is an Exim filter program
    Filter: start of processing
    Filter: end of processing
    rda_interpret: subprocess yield=0 error=NULL
    routed by blackberry_oversize router (unseen)
      envelope to: kbarrett@xxxxx.com
      transport:  none
    junk@kmb.com
        <-- junk@kmb.com
      router = localuser, transport = local_delivery
    search_tidyup called
    >>>>>>>>>>>>>>>> Exim pid=8191 terminating with rc=0 >>>>>>>>>>>>>>>>
    Is it possible that the mail command in a filter file does not inject the message back into exim and that it simply returns the message back to where it came into the filter?

  3. #3
    Join Date
    Oct 2005
    Posts
    2,358

    Re: Exim with complex forwarding issue

    Rather than using filters, it might be easier to use an autoreply transport. For example:
    Code:
    # BlackBerry Router over sized message:
    blackberry_notify:
    driver = accept
    condition = ${if >{$message_size}{1000000} {yes} {no} }
    unseen
    no_verify
    transport = blackberry_notify
    
    # BlackBerry Transport over sized message:
    blackberry_notify:
    driver = autoreply
    from = postmaster@$qualify_domain
    to = $local_part@$domain
    subject = Oversized message
    # etc.
    I'm the Proud Owner of the most dangerous weapon
    known to man kind: Human Brain

  4. #4
    Join Date
    Nov 2008
    Posts
    109

    Re: Exim with complex forwarding issue

    Thankyou for sending me in the right direction. The following is what I ended up with and it does seem to work.

    MY two Routers the first for under 1M and the second for over 1M
    Code:
    blackberry_aliases:
      driver = redirect
      allow_fail
      allow_defer
      condition = ${if <{$message_size}{1M}{yes}{no}}
      data = ${lookup{$local_part}lsearch{/etc/blackberry.aliases}}
      user = exim
      unseen
      no_verify
      file_transport = address_file
      pipe_transport = address_pipe
    
    blackberry_notify:
      driver = redirect
      allow_fail
      allow_defer
      condition = ${if <{$message_size}{1M}{no}{yes}}
      data = ${lookup{$local_part}lsearch{/etc/blackberry.aliases}}
      user = exim
      unseen
      no_verify
      redirect_router = blackberry_oversize
    The next Router (blackberry_oversize ) as seen above is called as a redirect_router. And is positioned below ( after ) the localuser router.
    Code:
    blackberry_oversize:
            driver = accept
            no_verify
            user=exim
            transport = blackberry_notify
    The last piece of the puzzle is the blackberry_notify transport:
    Code:
    blackberry_notify:
      driver = autoreply
      from = <$sender_address>
      subject = ${if def:h_Subject: {${quote:${escape:${length_50:$h_Subject:}}} (OVERSIZED)} }
      text = "\
            The message sent by $h_from was too large to deliver to your\n\
            blackberry ( size = $message_size )\n\n\
    "
      to = "$local_part@$domain"
    Again, Thanks for nudging me in the right direction. If anyone sees where This could be improved or where it could go badly please let me know ...

Similar Threads

  1. Need help in EXIM Documentation Project
    By AADI-JI in forum Education Career and Job Discussions
    Replies: 5
    Last Post: 19-11-2010, 12:41 PM
  2. Exim v4.7x implementation and DKIM
    By Vivan in forum Software Development
    Replies: 6
    Last Post: 17-06-2010, 03:35 AM
  3. Page too complex issue with HP color laserjet 2840
    By Asis in forum Hardware Peripherals
    Replies: 6
    Last Post: 13-06-2010, 12:33 AM
  4. Port forwarding Issue in Nokia Siemens C2110
    By supernoob in forum Networking & Security
    Replies: 5
    Last Post: 23-01-2010, 02:42 PM
  5. Exim configuration guide
    By BoanHed in forum Operating Systems
    Replies: 1
    Last Post: 13-02-2009, 11:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,565,429.69211 seconds with 16 queries