Topic: Why does this iRedAPD plugin trigger the error "loops back to myself"
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): latest 1.3
- Deployed with iRedMail Easy or the downloadable installer? downloadable
- Linux/BSD distribution name and version: Ubuntu 18
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
I have this plugin:
from libs import SMTP_ACTIONS
SMTP_PROTOCOL_STATE = ['RCPT', 'END-OF-MESSAGE']
def restriction(**kwargs):
size = kwargs['smtp_session_data']['size']
if size:
size = int(size)
else:
size = 0
if size < 10485760: # message size smalled than 10 MB
return SMTP_ACTIONS['default'] # which basically relays emails to external SMTP server (as configured in main.cf)
else: # it is bigger
return 'FILTER smtp:'
This is working fine except when a user with a domain hosted on my iRedMail server (first-domain.com) sends a big email (bigger than 10 MB) to a user under another domain hosted on my iRedMail server (second-domain.com), then delivery fails with postfix complaining that message loops to itself.
What is going wrong here? Thank you.
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.