Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How can I rewrite e-mail subjects?

Discussion in 'E-mail Discussion' started by kemis, Feb 18, 2006.

  1. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Georgetown, TX
    How can I rewrite e-mail subjects?

    To be clear, I am NOT asking how to customize SA's spam tag! :) Actually, I want to do somewhat of the opposite...

    My work implements a pretty horrible setup of SpamAssassin. Therefore, I am currently fetching mail from my work's POP3 account into my own Cpanel setup where I run my own spam checking.

    I want to be able to DELETE the ' *****SPAM***** ' tags that my work applies, since it tags a LOT of ham and gets real annoying to work with when replying to a customer, etc.

    I assume this would involve some sort of regex or filter in the exim configuration, but being a newbie, I don't want to start poking around without guidance.

    Any ideas?
    Matt
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,460
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Georgetown, TX
    Thanks for the link, Chirpy. After looking it over (it's all very new to me), I've come up with the assumption that I need a filter that resembles:

    Code:
    if $header_subject: contains "*****SPAM*****"
    then pipe "sed -e 's/*****SPAM*****//'"
    endif
    So, now I need to figure out several things:

    1. Is sed really what I need to use in this situation?
    2. Am I calling the sed command correctly?
    3. How do I get the message to continue to its intended destination after the search & replace?

    I found the following thread via Google that covers this exact topic, but it doesn't lead to a concise conclusion: http://www.exim.org/pipermail/exim-users/Week-of-Mon-19990222/011453.html

    I'll keep looking on my own, but if anyone wants to chime in with some ideas, I'd be very grateful. :D

    -- Matt
     
  4. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    168
    Could this type of search/replace operation be done on the message AFTER it's been delivered to the appropriate directory on the server, but *before* the client has picked it up?

    Can a trigger be setup that each time a new message comes in, the script could be run? Or ??
     
  5. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Georgetown, TX
    I'm so close! I have the following filter that searches & replaces just fine. The only piece of the puzzle I'm now missing is how to actually get the output of the replace command back into exim for delivery! I tried a "deliver" statement, but that just delivers the original message, not the desired one.

    Code:
    if
     $header_subject: contains "*****SPAM***** "
    then
     pipe "replace -s '*****SPAM***** ' ''"
    endif
    I've searched and searched! I honestly have no idea how to get the final message delivered. :(

    Matt

    P.S. -- Lyttek, I could set up a cron job to run the replace command on the appropriate mailboxes, but I wonder what would happen if/when a mail client attempts to download messages as the replace routine is running?
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice