Skip to content

[BUG] imapfetch.py fails when 'Type' (of server) is set to 'imap' in Web UI #439

@Pique7

Description

@Pique7

Describe the bug
When configuring an IMAP import via the Piler Web UI with Type of server set to "imap" (no SSL/TLS), the imapfetch.py script fails to initialize the connection. Output / error message:

Traceback (most recent call last):
  File "/usr/libexec/piler/imapfetch.py", line 235, in <module>
    main()
    ~~~~^^
  File "/usr/libexec/piler/imapfetch.py", line 206, in main
    conn.login(user, password)
    ^^^^
UnboundLocalError: cannot access local variable 'conn' where it is not associated with a value

To Reproduce
Steps to reproduce the behavior:

  1. Create an import entry with the Web UI
  2. Set Type (of server) to imap (no SSL/TLS)
  3. Fill other fields and apply.
  4. Call /usr/libexec/piler/import.sh

Expected behavior
A connection to the IMAP server should be established.

Piler version:
v1.4.8

Additional context
OS: Debian 13 (Trixie)
Python: 3.13.5

Notes
Possible fix:
I identified that when selecting "imap" for Type (of server) in the Web UI, the database field security is populated with the value 'imap'. However, imapfetch.py at line 195 only checks for 'no'. I manually modified line 195 in /usr/libexec/piler/imapfetch.py:

Original:

    if security == 'no':

Changed to:

    if security in ['no', 'imap']:

This seems to work for my case, but I haven't dealt with it in any other depth.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions