Spamassassin rule to trap sender and receiver having the same address

Posted on 2007-08-05
Last Modified: 2013-12-09
I'm running Spamassassin on my pop server and frequently receive emails containing myself as the sender and the receiver.

Any rule that can be written that would trap this?
Question by:oceansupport
    LVL 36

    Expert Comment

    You could use something like :-

    header __LOCAL_FROM_01  From =~ /address1\@example\.com/i
    header __LOCAL_TO_01  To =~ /address1\@example\.com/i
    meta LOCAL_FROMTO_01  (__LOCAL_FROM_01 && __LOCAL_TO_01)
    score  LOCAL_FROMTO_01 2.0
    describe LOCAL_FROMTO_01 Mail sent from and to the same address

    It creates two header rules to match your email address in the from and to field. Then a meta rule matches if both the header checks match and a score is applied. You can copy and paste the code however many times you want. You just need to increment the '01' suffic to the rule names and change the email addresses.

    Author Comment

    Can do a universal rule without hard coding every address?  I have 40 users.

    LVL 36

    Accepted Solution

    Unfortunetly not using standard rules as it does not have any string comparison functionality. The only thing you could do is write your own custom plugin using perl but that is a lot more complex.

    What mail server software are you using?
    You could configure it to refuse all email from your email addresses. Any users sending mail should either be sending from a trusted IP address or use SMTP authentication anyway.

    Author Comment

    not sure that would work...the server is hosted by Verio.  I'll get in touch with them to see if this is possible.  If I send myself a note (I know the CEO does this)...then my own message will be blocked, no?

    thanks for the advice.
    LVL 36

    Expert Comment

    If you send yourself a note then it should be blocked however there are a couple of cases where it might not depending on the configuration :-

    1) Your companies IP addresses may be listed as trusted networks in the spamassassin configuration and this may stop the message being flagged as a spam.

    2) If you use SMTP AUTH (password required to send mail) then this config may bypass the spam checked.

    Oviously if you have your own internal mail server then if you sent it via it then it would not go through the verio server at all.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Operating system developers such as Microsoft ( and Apple have made incredible strides in virus protection over the past decade. Operating systems come packaged with built in defensive tools such as virus protection and a f…
    Ransomware continues to be a growing problem for both personal and business users alike and Antivirus companies are still struggling to find a reliable way to protect you from this dangerous threat.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now