Koozali.org: home of the SME Server

how to reject mail to unknown users, not to return it

Offline monge

  • *
  • 6
  • +0/-0
    • http://www.mokj.dk
how to reject mail to unknown users, not to return it
« on: October 14, 2006, 11:40:30 AM »
I am looking for a method to get my server to reject mail to unknown users. The only possibility i see in the server-manager is to return and i do not like that method.
I am getting a lot of mail from others ok-servers that say that they have received a mail from my server to an unknown user and therefore it is returned to my server. But the mails are not sent from here and it looks like there is a virus in the mail.
So I don’t want to participate in this spreading of spam and virus and therefore I want to put mail to unknown users directly in the trash.
Can somebody help me?

Offline JonB

  • *
  • 351
  • +0/-0
how to reject mail to unknown users, not to return it
« Reply #1 on: October 14, 2006, 01:51:17 PM »
The email is rejected, with a 550 invalid_recipient.

What you could do is create a user called trash and have all emails for unknown users sent there. Set up cronjob to delete emails in this mailbox on a regular basis.

The other option is to delete the double bounce email. Do a search  on this forum for 'double bounce' for instructions on how to do that.

Jon
...

Offline mmccarn

  • *
  • 2,656
  • +10/-0
how to reject mail to unknown users, not to return it
« Reply #2 on: October 14, 2006, 02:57:04 PM »
I'd recommend:
    - Read & implement the Sonoracomm howto for configuring spam filtering:
http://www.sonoracomm.com/index.php?option=com_content&task=view&id=49&Itemid=32
- Delete double-bounce messages as shown here: http://forums.contribs.org/index.php?topic=33815.0
- and check to see how the unwanted messages are getting in.  [/list]After installing SME 7, the only real problem we have left is the permissive nature of our backup mx server.  SME rejects messages with 550 invalid_recipient during the SMTP conversation with the sender, but our backup mx server does not.  Spam received for unknown users by the backup mx is accepted by SME, then generates a bounce email, which usually doesn't go anywhere, generating another bounce to the non-existent local account...

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
how to reject mail to unknown users, not to return it
« Reply #3 on: October 17, 2006, 01:39:42 AM »
Quote from: "mmccarn"

After installing SME 7, the only real problem we have left is the permissive nature of our backup mx server.  SME rejects messages with 550 invalid_recipient during the SMTP conversation with the sender, but our backup mx server does not.  Spam received for unknown users by the backup mx is accepted by SME, then generates a bounce email, which usually doesn't go anywhere, generating another bounce to the non-existent local account...


First off I'd suggest that you just get rid of the backup mx server. These days they aren't required, and as you've discovered, they make it significantly more difficult to fight spam.

I'd also investigate why the SME server is accepting the mail from the backup mx server. The SME server shouldn't accept mail for invalid recipients from any  other server on the internet, whether it's a backup mx server or not.

Offline mmccarn

  • *
  • 2,656
  • +10/-0
how to reject mail to unknown users, not to return it
« Reply #4 on: October 17, 2006, 03:29:22 PM »
Thanks, Ray; I've been thinking along the same lines re: dropping the backup MX.

As for the accepted emails, my SME is configured to use an "Internal mail server", so my "goodrcptto" includes "@mydomain.org", allowing receipt of all incoming email.  Perhaps this is the problem!

I don't supposed there's an LDAP module for qpsmtpd that integrates with the goodrcptto plugin, or a plugin that monitors the qmail logs for email declined by my internal mail server, and adds those addresses to 'badrcptto', or something like that?

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
how to reject mail to unknown users, not to return it
« Reply #5 on: October 17, 2006, 03:48:23 PM »
Quote from: "mmccarn"
Thanks, Ray


My name is not (and has never been) Ray.

Quote

As for the accepted emails, my SME is configured to use an "Internal mail server", so my "goodrcptto" includes "@mydomain.org", allowing receipt of all incoming email.  Perhaps this is the problem!


Indeed. If the SME server does not have a full valid user list, it cannot reject mail to unknown users. If you do have such a list, and can keep it up to date, then you can use a custom template to get the desired behaviour.

Offline mmccarn

  • *
  • 2,656
  • +10/-0
how to reject mail to unknown users, not to return it
« Reply #6 on: October 17, 2006, 04:26:04 PM »
[ashamed]
Oops!

(OK, I admit it, I get you and RayMitchell confused...)

Thanks, Charlie!
[/ashamed?]

Offline raem

  • *
  • 3,972
  • +4/-0
how to reject mail to unknown users, not to return it
« Reply #7 on: October 18, 2006, 12:52:41 AM »
mmccarn

> ....I get you (CharlieBrady) and RayMitchell confused

Thanks for the compliment, but Charlie's technical knowledge is far superior to mine !
A lot of what I know came from Charlie anyway (and from Gordon, not wanting to leave him out either) ! Thanks to them both.
...

Offline dmajwool

  • *****
  • 180
  • +0/-0
Re: how to reject mail to unknown users, not to return it
« Reply #8 on: December 02, 2006, 02:27:51 PM »
Quote from: "monge"
I am looking for a method to get my server to reject mail to unknown users. The only possibility i see in the server-manager is to return and i do not like that method.

I'm on this learning curve too, and I think that maybe the server-manager wording is slightly fuzzy.  Please can someone clarify:
I think if you select "Return to Sender" then all that is returned is a short 550 error message.  The message itself is not returned.
In my test (sending to jhsdfksf@mydomain.com from my gmail account) I received the following from the google mail daemon
Code: [Select]
Mail Delivery Subsystem
<mailer-daemon@googlemail.com> to me

This is an automatically generated Delivery Status Notification

Delivery to the following recipient failed permanently:

    jhsdfksf@mydomain.com

Technical details of permanent failure:
PERM_FAILURE: SMTP Error (state 9): 550 invalid recipient jhsdfksf@mydomain.com

  ----- Original message -----

Received: by 10.65.151.6 with SMTP id d6mr8580585qbo.116506352;
       Sat, 02 Dec 2006 04:45:25 -0800 (PST)
Received: by 10.65.123.17 with HTTP; Sat, 2 Dec 2006 04:45:25 -0800 (PST)
Message-ID: <39adab7c0612020445uee163e7t7a4dcbe4f@mail.gmail.com>
Date: Sat, 2 Dec 2006 12:45:25 +0000
From: me
Sender: me@gmail.com
To: jhsdfksf@mydomain.com
Subject: gmail to non-existant user
MIME-Version: 1.0
Content-Type: multipart/alternative;
       boundary="----=_Part_9964_17239254.1165063525144"
X-Google-Sender-Auth: 0042b1bbc2e6xxx

------=_Part_9964_17239254.1165063525144
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
Best regards,

  ----- Message truncated -----

Because the "original message" part of the return notification does not include anything en route to mydomain.com,  I think this demonstrates that the error code only was returned by SME and the original message was added by the originating server, which I believe is the preferred behaviour.

Corrections welcomed, this is a confusing area for me.

David.

Offline raem

  • *
  • 3,972
  • +4/-0
Re: how to reject mail to unknown users, not to return it
« Reply #9 on: December 03, 2006, 10:52:52 AM »
dmajwool

> Corrections welcomed, this is a confusing area for me.

The server manager panel wording says:

Designate what you'd like the server to do with email messages sent to unknown users. Select Return to sender (recommended setting) to return the message to the sender with an error message. Selecting Send to ... will cause the message to be sent to that user.

Perhaps it should say:

.......Select Return to sender (recommended setting) to reject the message and send an error message to the sender........

If you feel strongly enough about it, add a bug to bugzilla, under server manager panel text or similar.
...

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: how to reject mail to unknown users, not to return it
« Reply #10 on: December 03, 2006, 05:25:08 PM »
Quote from: "RayMitchell"

Perhaps it should say:

.......Select Return to sender (recommended setting) to reject the message and send an error message to the sender........


That would be inaccurate. If the message is rejected, SME server doesn't send an error message.

Offline dmajwool

  • *****
  • 180
  • +0/-0
Re: how to reject mail to unknown users, not to return it
« Reply #11 on: December 03, 2006, 11:24:32 PM »
Quote from: "CharlieBrady"
. If the message is rejected, SME server doesn't send an error message.

And that is the behaviour wished for by the OP.  Do the developers feel that is a poor response to badly addressed mail?

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: how to reject mail to unknown users, not to return it
« Reply #12 on: December 04, 2006, 10:07:44 PM »
Quote from: "dmajwool"
Quote from: "CharlieBrady"
. If the message is rejected, SME server doesn't send an error message.

And that is the behaviour wished for by the OP.  Do the developers feel that is a poor response to badly addressed mail?


Do you think it is a poor response?

Offline dmajwool

  • *****
  • 180
  • +0/-0
Re: how to reject mail to unknown users, not to return it
« Reply #13 on: December 04, 2006, 10:46:17 PM »
Quote from: "CharlieBrady"
Do you think it is a poor response?


I think it is a questionable response. Whilst it is discourteous not to ping a reminder about a genuine typo from an otherwise welcome email, these days all of the invalidly addressed mail I receive is spam.

Quote from: "dmajwool"
I'm on this learning curve too,.... this is a confusing area for me


I have not spent years working with the finer details of email specifications, so some guru comment would help me to understand the situation better.

Thanks,
David.

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: how to reject mail to unknown users, not to return it
« Reply #14 on: December 05, 2006, 01:07:03 AM »
Quote from: "dmajwool"
Quote from: "CharlieBrady"
Do you think it is a poor response?


I think it is a questionable response. Whilst it is discourteous not to ping a reminder about a genuine typo from an otherwise welcome email, these days all of the invalidly addressed mail I receive is spam.


I don't understand what point you are trying to make. If you think that SME server does something other than what it should do, please raise it in the Bug Tracker.