1

Topic: few question for notify_quarantined_recipients.py

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.6
- Linux/BSD distribution name and version: CentOS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MYSQL
- Web server (Apache or Nginx):APACHE
- Manage mail accounts with iRedAdmin-Pro? Yes
- Related log if you're reporting an issue:
====
Hi,

I want to ask some question about the notify_quarantined_recipients.py.

1) how can i change the sender name ? now is No Reply, want change it to such as MIS Message

2) i found that the time on the list inside the notification email is wrong, it should be UTC+8. it's OK when i login the iredadmin just wrong inside the mail.

Thanks!

----

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

2

Re: few question for notify_quarantined_recipients.py

1) There're few variables (NOTIFICATION_*) defined in file "libs/default_settings.py" for notify_quarantine_recipients.py. like below.
2) It's a bug that it didn't read time zone from iRedAdmin-Pro config file, i will fix it. Thanks for the feedback. smile

# SMTP server address, port, username, password used to send notification mail.
NOTIFICATION_SMTP_SERVER = 'localhost'
NOTIFICATION_SMTP_PORT = 587
NOTIFICATION_SMTP_STARTTLS = True
NOTIFICATION_SMTP_USER = 'no-reply@localhost.local'
NOTIFICATION_SMTP_PASSWORD = ''
NOTIFICATION_SMTP_DEBUG_LEVEL = 0

# The short description or full name of this smtp user. e.g. 'No Reply'
NOTIFICATION_SENDER_NAME = 'No Reply'

#
# Used in notification emails sent to recipients of quarantined emails.
#
# URL of your iRedAdmin-Pro login page which will be shown in notification
# email, so that user can login to manage quarantined emails.
# Sample: 'https://your_server.com/iredadmin/'
#
# Note: mail domain must have self-service enabled, otherwise normal
#       mail user cannot login to iRedAdmin-Pro for self-service.
NOTIFICATION_URL_SELF_SERVICE = ''

# Subject of notification email. Available placeholders:
#   - %(total)d -- number of quarantined mails in total
NOTIFICATION_QUARANTINE_MAIL_SUBJECT = '[Attention] You have %(total)d emails quarantined and not delivered to mailbox'

3

Re: few question for notify_quarantined_recipients.py

roy.wong wrote:

2) i found that the time on the list inside the notification email is wrong, it should be UTC+8. it's OK when i login the iredadmin just wrong inside the mail.

Fixed. here's the patch if you want to give it a try:

diff -r d11e918041ce tools/notify_quarantined_recipients.py
--- a/tools/notify_quarantined_recipients.py    Tue Mar 21 20:21:46 2017 +0800
+++ b/tools/notify_quarantined_recipients.py    Thu Mar 30 00:36:16 2017 +0800
@@ -79,6 +79,7 @@
 import os
 import sys
 import time
+from datetime import datetime
 from email.mime.text import MIMEText
 from email.mime.multipart import MIMEMultipart
 from email.header import Header
@@ -97,6 +98,7 @@
 
 import settings
 from libs import iredutils
+from libs.ireddate import utc_to_timezone
 from tools import ira_tool_lib
 
 web.config.debug = ira_tool_lib.debug
@@ -294,7 +296,9 @@
             # PostgreSQL time with time zone
             time_iso = iredutils.set_datetime_format(time_iso[:-6], time_format='%Y%m%d%H%M%S')
 
-        time_tuple = time.strptime(time_iso, '%Y%m%d%H%M%S')
+        dt = datetime.strptime(time_iso, '%Y%m%d%H%M%S')
+        time_with_tz = utc_to_timezone(dt=dt, timezone=settings.LOCAL_TIMEZONE)
+        time_tuple = time.strptime(time_with_tz, '%Y-%m-%d %H:%M:%S')
         mail_date = time.strftime('%b %d, %Y', time_tuple)
         mail_time = time.strftime('%H:%M', time_tuple)

4 (edited by roy.wong 2017-03-30 10:17:44)

Re: few question for notify_quarantined_recipients.py

it works for Both #1 and #2 big_smile

Many Thanks!