autoreply not to Spammer

Discussion in 'General' started by vistree, Dec 3, 2006.

  1. vistree

    vistree Member HowtoForge Supporter

    Hi, is it possible to modify the autoresponder-script in a way, that SPAM-detected mails are not included (no autoresponder for email containing the rewrite subjet from the user-spamfilter-dialog)?

    Regards
    Kai
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. You can try to modify the autoresponder procmail recipe in /root/ispconfig/isp/conf/
     
  3. vistree

    vistree Member HowtoForge Supporter

    Thank you till for reply!
    I had a look at the autoresponder.rc.master - but thing that this job is to big for me!
    Did anyone allready tried this? I think this could be a matter of general intesest, as every autoreply to a Spammer (which mostly use not-existing-email-adresses) causes in an additonal mail in the users inbox: a not delivered notice from postfix.

    Kai
     
  4. falko

    falko Super Moderator Howtoforge Staff

    You could put this at the beginning of the autoresponder file:

    Code:
    :0:
    * ^X-Spam-Status: Yes
    so that it looks like this:

    Code:
    :0:
    * ^X-Spam-Status: Yes
    
    SHELL=/bin/sh    # for other shells, this might need adjustment
    EMAIL=`formail -zxTo:`
    [...]
    I haven't tested this, but it could work.
     
  5. vistree

    vistree Member HowtoForge Supporter

    Hi Falko,
    thank you for that code - I already put it in a testaccount. Normals Mails are still replied. I wait until tomorrow and post the result of incomming spam.

    Regards
    Kai
     
  6. vistree

    vistree Member HowtoForge Supporter

    Hi Falko an forum,
    the solution code
    does not work for me ...
    Is it enough just to include this code in the autoresponder.rc or must there be any other changes for example in the master.cf of postfix?!
    Could it work with a smal change in the code? e.g.
    instead

    Regards
    Kai
     
  7. falko

    falko Super Moderator Howtoforge Staff

    It must be in your .autoresponder.rc only (and also in the template in /root/ispconfig/isp/conf, otherwise ISPConfig will overwrite your changes).

    Yes. Try it. This tutorial might be interesting for you: http://www.howtoforge.com/procmail_tips_recipes
     
  8. vistree

    vistree Member HowtoForge Supporter

    working solution

    Testing around a little bit, we found a very simple solution. The job was to insert Falkos code at the correct place:

    We modified the file:
    /root/ispconfig/isp/conf/autoresponder.rc.master

    inserting the line after "# Don't reply to SPAM"

    Code:
    SHELL=/bin/sh    # for other shells, this might need adjustment
    EMAIL=`formail -zxTo:`
    
                  :0 Whc: vacation.lock
                   # Perform a quick check to see if the mail was addressed to us
                   #* $^To:.*\<$\LOGNAME\>
                   # Don't reply to daemons and mailinglists
                  * !^FROM_DAEMON
                   # Don't reply to SPAM
                  * !^X-Spam-Status: Yes
                   # Mail loops are evil
                  * !^X-Loop: ${EMAIL}
                  | formail -rD 8192 {PFAD}/.vacation.cache
    
                    :0 ehc         # if the name was not in the cache
                    | (formail -rI"From: {EMAIL_ADDRESS}" -I"Precedence: junk" \
                         -A"X-Loop: ${EMAIL}" ; \
                       cat {PFAD}/.vacation.msg \
                      ) | $SENDMAIL -oi -t
    
    Of course, the code effect only accounts marked for autoreply after this modification. So for existing autoreplies just disable and enable again using one of the possiblities offert by ISPConfig (domain-control or mailuser-login)

    Have a nice weekend
    Kai
     

Share This Page