1 (edited by marius.timukas 2020-11-05 05:51:27)

Topic: quarantined Emails - notification

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

   Hello,

After upgrade to iRedAdmin-Pro 4.6, I found a problem with notification about quarantined email.

[root@mail ~]# /usr/bin/python3 /var/www/iredadmin/tools/notify_quarantined_recipients.py --force-all
* + << ERROR >> Error while sending notification email to username@domain.ltd: TypeError("a bytes-like object is required, not 'str'",)

After each run of the script, a new message appears in quarantine list. The notification message is stopped with the SPAM flag.

X-Amavis-Alert:     BAD HEADER SECTION, MIME error: error: unexpected end of header
X-Spam-Status:      Yes, score=5.138 tag=-100 tag2=5 kill=5 tests=[BAYES_20=-0.001, EMPTY_MESSAGE=2.32, MISSING_HEADERS=1.021, MISSING_SUBJECT=1.799, NO_RELAYS=-0.001] autolearn=no autolearn_force=no

Regards,
Marius

2

Re: quarantined Emails - notification

Confirmed it's a bug of iRedAdmin-Pro and fixed moment ago. Here's patch for iRedAdmin-Pro-SQL-4.6 and iRedAdmin-Pro-LDAP-4.7. If you're not familiar with patch, contact us to get a patched version.

diff --git a/libs/iredutils.py b/libs/iredutils.py
index 18f3962e..c1bc3cc4 100644
--- a/libs/iredutils.py
+++ b/libs/iredutils.py
@@ -836,9 +836,10 @@ def sendmail_with_cmd(from_address, recipients, message_text):
 
     cmd = [settings.CMD_SENDMAIL, "-f", from_address, recipients]
 
+    msg = str2bytes(message_text)
     try:
         p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
-        p.stdin.write(message_text)
+        p.stdin.write(msg)
         p.stdin.close()
         p.wait()
 

----

Buy me a cup of coffee ($5) to support iRedMail:

buy me a cup of coffee