1

Topic: notify_quarantined_recipients.py - Bug with timezones in settings.py

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: Ubuntu 16 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- 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.
====

Hello Zhang Huangbin,

we got an issue with the notifiy script. When i set the timezone in /opt/www/iredadmin/settings.py from LOCAL_TIMEZONE = 'GMT' to LOCAL_TIMEZONE = 'GMT+01:00' and one or more user have spam in the quarantine then the script failed:

/usr/bin/python /opt/www/iredadmin/tools/notify_quarantined_recipients.py --force-all
* 8 users are willing to receive notification email.
Traceback (most recent call last):
  File "/opt/www/iredadmin/tools/notify_quarantined_recipients.py", line 301, in <module>
    time_tuple = time_with_tz.timetuple()
AttributeError: 'str' object has no attribute 'timetuple'

when i change it back to LOCAL_TIMEZONE = 'GMT the script is working well:
/usr/bin/python /opt/www/iredadmin/tools/notify_quarantined_recipients.py --force-all
* 8 users are willing to receive notification email.
* + *****@******.de: 1 mails.

Maybe i do something wrong? Or your script has a problem? Please help us smile

Best wiches
Vincent

2

Re: notify_quarantined_recipients.py - Bug with timezones in settings.py

I tried this time zone locally, it works for me.
I wonder whether you have any incorrect char in LOCAL_TIMEZONE value. could you double check?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3

Re: notify_quarantined_recipients.py - Bug with timezones in settings.py

ZhangHuangbin wrote:

I tried this time zone locally, it works for me.
I wonder whether you have any incorrect char in LOCAL_TIMEZONE value. could you double check?

Hello,

yes i check this many times, change the timezone, change the line etc. :


#LOCAL_TIMEZONE = 'GMT'
LOCAL_TIMEZONE = 'GMT+01:00' 

do you have any idea? I already set up a new server to reproduce this script error with the same issue. First Ubuntu 18 and on the second try with Ubuntu 16.

4

Re: notify_quarantined_recipients.py - Bug with timezones in settings.py

I can not reproduce this issue on my local machine. Is it possible to give me direct ssh access with root privilege? contact me: https://www.iredmail.org/support.html

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

5

Re: notify_quarantined_recipients.py - Bug with timezones in settings.py

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

  Hello,

we have the same problem. This problem I saw with early version too (iRedMail 0.9.8 and iRedAdmin-Pro 2.9).

/usr/bin/python /var/www/iredadmin/tools/notify_quarantined_recipients.py --force-all
* 479 users are willing to receive notification email.
Traceback (most recent call last):
  File "/var/www/iredadmin/tools/notify_quarantined_recipients.py", line 299, in <module>
    time_tuple = time_with_tz.timetuple()
AttributeError: 'str' object has no attribute 'timetuple'

I changed one line:

        #time_tuple = time_with_tz.timetuple()
        time_tuple = time.strptime(time_with_tz, '%Y-%m-%d %H:%M:%S')

Regards,
Marius

6

Re: notify_quarantined_recipients.py - Bug with timezones in settings.py

marius.timukas wrote:

I changed one line:
        #time_tuple = time_with_tz.timetuple()
        time_tuple = time.strptime(time_with_tz, '%Y-%m-%d %H:%M:%S')

Do you mean this changed line works for you?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

7 (edited by Mr.TW 2018-12-19 23:16:15)

Re: notify_quarantined_recipients.py - Bug with timezones in settings.py

Hi Marius,

many thanks to you! Thats it!

8

Re: notify_quarantined_recipients.py - Bug with timezones in settings.py

Hello,

Yes, it's work for me. Tested on iRedAdmin-Pro 2.9 and 3.0 versions.
I found this solution on iRedAdmin-Pro 2.7 .