Topic: Python error in notify_quarantined_recipients.py

- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: Ubuntu 16.04
- 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.

The cronjob which alert users of a quarantined mail fail since the upgrade to 0.9.9 with the following error:

Traceback (most recent call last):
  File "/opt/www/iredadmin/tools/notify_quarantined_recipients.py", line 300, in <module>
    time_tuple = time.strptime(time_with_tz, '%Y-%m-%d %H:%M:%S')
  File "/usr/lib/python2.7/_strptime.py", line 478, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib/python2.7/_strptime.py", line 329, in _strptime
    found = format_regex.match(data_string)
TypeError: expected string or buffer

We only have a single BANNED type email in quarantine and nothing else. Any idea what might cause this ?



Re: Python error in notify_quarantined_recipients.py

Quack66 wrote:


Open this file, find line 300 like below:

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

Replace it by:

        time_tuple = time_with_tz.timetuple()

Run the script manually, does it work for you?

python /opt/www/iredadmin/tools/notify_quarantined_recipients.py


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

buy me a cup of coffee


Re: Python error in notify_quarantined_recipients.py

Thanks for the reply Zhang. The line

time_tuple = time_with_tz.timetuple()

was commented so I've uncommented it and commented the one that caused issues instead.

This now works fine !

Thanks for the help