Creating a mail address that goes to /dev/null

Discussion in 'Installation/Configuration' started by fbarcenas, Aug 5, 2015.

  1. fbarcenas

    fbarcenas Member

    Is it possible to create a mail address that accepts and dumps the mail??
    If I uncheck the box that says receive the mail just sits around in postfix. I prefer something that goes to /dev/null. Is there any way to do that within ISPCONFIG??
  2. Jesse Norell

    Jesse Norell Well-Known Member

    If you use sieve, you can just use a 'discard' - it should be as simple as:
  3. fbarcenas

    fbarcenas Member

    I don't think I use sieve.. hmm...
  4. Jesse Norell

    Jesse Norell Well-Known Member

    You probably have either sieve or procmail I'd guess. I'm just playing around with a first-time ispconfig install, so not terribly familiar, but following the debian jessie perfect server tutorial I find sieve present on this test installation. Check /var/vmail/{domain}/{user}/ and see if there's a .sieve file there; if so, just edit it and replace the contents with the above discard/stop and you should be good.

    Note/thought: I don't know if ispconfig will overwrite that .sieve file at any point.

    FWIW, roundcube has a nice sieve filter plugin I've played with in the past which you could probably use to create/manage a sieve filter rather than directly editing the file. squirrelmail has one too, but it's not nearly as nice. Both of them require the managesieve server to be running.
  5. fbarcenas

    fbarcenas Member

    Cool thanks, I'll check it out.
  6. Jesse Norell

    Jesse Norell Well-Known Member

    Hey, looks like there's a "Mail Filter" tab under mailbox settings. I just added a test filter there, and it updated the .sieve filter file to accomplish almost what you want.

    The filter I made had a name (discard all), matched the To header, set Contains to the single "@" character, and action is Delete. Here's the filter you get:

    # cat /var/vmail/
    require ["fileinto", "regex", "date", "relational", "vacation"];
    if header :regex    ["to"] [".*@"] {
    ### END FILTER_ID:1
    I suspect that will NOT match for To: undisclosed-recipients; and various other emails without a regular email address in To:. You could make some more filters to help, eg. a similar one for From header, one for From: <>, one for To: undisclosed-recipients; and the like, but I don't see any way to not specify matching criteria there, so you may end up with some mail getting through. Probably have to file feature requests to expand the mail filter functionality to do much better, but try creating:

    Discard From Contains <
    Discard From Contains @
    Discard To Contains -
    Discard To Contains <
    Discard To Contains @
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Or you add a custom filter on the "custom rules" tab of the mailbox.
    Jesse Norell likes this.
  8. Jesse Norell

    Jesse Norell Well-Known Member

    Yep, use 'custom rules' with just
    and it'll do exactly what you want.

Share This Page