1

Topic: Bounce Invalid recipients instead of Reject

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? Downloadable Installer
- Linux/BSD distribution name and version: Ubuntu 18.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PostgreSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi all,

Not sure if this question had been asked, but I just couldn't find the right answer to this.
Scenario:
* Using Outlook with EAS (Exchange ActiveSync) - via SOGo.
* UserA@mydom.com send email to xxy@invaliddomain.com or invaliduser@domain.com, it is ok and gotten a NDR back.
* UserA@mydom.com send email to invaliduser@mydom.com (same domain), stuck in the Outbox instead.

How do I make it to bounce with NDR instead of just stuck in Outbox.

In the Logs, it is showing below.

Recipient address rejected: User unknown in virtual mailbox table;


I tried to change the Postfix main.cf by not rejecting invalid recipients, but I find it is wrong. If I don't reject, means there won't be any NDR bouncing back. Hence, how do I allow Outlook to just put the email to sent Item folder and not Outbox.

Thanks!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Bounce Invalid recipients instead of Reject

Rejection returns with code "500" (or "5xx") should be considered as hard fail and not retry.
Seems it's a Outlook side issue, not mail server. It handles the rejection "improperly".

3

Re: Bounce Invalid recipients instead of Reject

ZhangHuangbin wrote:

Rejection returns with code "500" (or "5xx") should be considered as hard fail and not retry.
Seems it's a Outlook side issue, not mail server. It handles the rejection "improperly".

Hi Huangbin,

No, actually I tried other outlook version like 2013, 2016, and even outlook 365. All having same behaviour. That is if you email to same domain but the email is not valid, it will stuck in outbox. It doesn't move to sent item and deliver a non delivery receipt email back.

Error in logs is the same as if i email out to other nonvalid email address in other domains,but i receive non delivery report and email is in sent item.

Only local domain that this email server hosting will have this issue.

Thanks!

Exam

4

Re: Bounce Invalid recipients instead of Reject

Seems you didn't understand my previous reply. sad

Postfix already rejects the email with code 500 (or 5xx) with error message "Recipient address rejected: User unknown in virtual mailbox table", mail client applications like Outlook, Thunderbird, or webmail should stop trying/retrying to send email when they get 500/5xx code. Obviously Outlook still wants to re-send the email which is not right.

5

Re: Bounce Invalid recipients instead of Reject

ZhangHuangbin wrote:

Seems you didn't understand my previous reply. sad

Postfix already rejects the email with code 500 (or 5xx) with error message "Recipient address rejected: User unknown in virtual mailbox table", mail client applications like Outlook, Thunderbird, or webmail should stop trying/retrying to send email when they get 500/5xx code. Obviously Outlook still wants to re-send the email which is not right.

Hi Huangbin,

Ok, seems like i understand now, is there a way to make it like at least send once and reject with NDR instead of letting it sits in outbox??

6

Re: Bounce Invalid recipients instead of Reject

It's possible, but the tradeoff is "huge" (IMO).

Note: i didn't test it myself yet, but it should work.

In /etc/postfix/main.cf, find this:

# Recipient restrictions
smtpd_recipient_restrictions =
    reject_non_fqdn_recipient
    reject_unlisted_recipient
    check_policy_service inet:127.0.0.1:7777
    permit_mynetworks
    permit_sasl_authenticated
    reject_unauth_destination

Move rule "reject_unlisted_recipient" after "permit_sasl_authenticated":

# Recipient restrictions
smtpd_recipient_restrictions =
    reject_non_fqdn_recipient
    check_policy_service inet:127.0.0.1:7777
    permit_mynetworks
    permit_sasl_authenticated
    reject_unlisted_recipient
    reject_unauth_destination

Just a remind and warning: with default smtpd_recipient_restrictions setting, Postfix already correctly rejects email sent to non-existing (local) mail users, it works as expected, and it saves system resources used to go through other rules defined in smtpd_recipient_restrictions. For example, rule "check_policy_service inet:127.0.0.1:7777" will go through iRedAPD service, it will query SQL server for some checkings.

Again, this is an Outlook issue, not iRedMail server side configuration.

7

Re: Bounce Invalid recipients instead of Reject

Hi Huangbin,

sorry to reply so late. Tested this and is not working.

Below is my config:
# Recipient restrictions
smtpd_recipient_restrictions =
    reject_non_fqdn_recipient
    check_policy_service inet:127.0.0.1:7777
    permit_mynetworks
    permit_sasl_authenticated
    reject_unlisted_recipient
    reject_unauth_destination

Did i did something wrong?

I had tested using Outlook, Iphone / android phones, all are the same behaviour.

Basically, if I were to send an email from my own domain, and the receiver is not a valid user, it will just stuck at Outbox. Same for mobile phones.

Objective is to bounce and give NDR instead of just stuck at outbox.

Thanks!

8

Re: Bounce Invalid recipients instead of Reject

Hi Huangbin,

I further isolate this issue and found out that only ActiveSync is affected.

* If I use Outlook create a POP3 or IMAPS Profile, and send an email to any non-valid same domain email, the email will actually goes to the Sent Item and I receive a Bounce email from System Administrator saying the email is undeliverable. This is same for using mobile phones as well.

* If I use Outlook to have a Profile using ActiveSync, or mobile, then the email will stuck in Outbox instead of going to Sent Item and gives a Bounce email.

I do understand the receiver email is invalid within the same domain, but we want to achieve is sent it and bounce with a non delivery instead of just stucking at Outbox in Outlook or the Mobile phones. I tried different mail clients also behaving the same. Like mobile, I use GMail app, also same behaviour, Default Iphone and Android phone Email app also same behaviour.

Hence, I find it is something to do with the email system portion but couldn't find where is it.

hope you can advise.

thanks!

9

Re: Bounce Invalid recipients instead of Reject

Hi Huangbin,

I notice this link and will test this tonight.

https://sogo.nu/bugs/view.php?id=4270

10

Re: Bounce Invalid recipients instead of Reject

The reporter of the issue is another iRedMail user and i met him few times in person. smile
Unfortunately, SOGo team didn't realize it's a bug. sad

11

Re: Bounce Invalid recipients instead of Reject

ZhangHuangbin wrote:

The reporter of the issue is another iRedMail user and i met him few times in person. smile
Unfortunately, SOGo team didn't realize it's a bug. sad

I hope we have chance to meet up in person. and I just send you an email. I think from there you know who I am.

this is indeed a problem but I haven't tested what is in the forum yet. Will do so let you know if it works. If you see any potential issues, please let me know so I won't step into any bomb.

thanks!