Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Email consuming problem #117

Closed
buhino opened this issue Apr 27, 2016 · 8 comments
Closed

Email consuming problem #117

buhino opened this issue Apr 27, 2016 · 8 comments

Comments

@buhino
Copy link

buhino commented Apr 27, 2016

Good morning everyone, im testing the email consuming via docker with this config:

PAPERLESS_CONSUME_MAIL_HOST="mydomain.com"
PAPERLESS_CONSUME_MAIL_PORT=143
PAPERLESS_CONSUME_MAIL_USER="paperless@mydomain.com"
PAPERLESS_CONSUME_MAIL_PASS="******"

The output nc in the consumer container:

root@06b23568a3f4:/usr/src/paperless/src# nc -vv mail.mydomain.com 143
DNS fwd/rev mismatch: mail.mydomain.com != ns1.mydomain.com
mail.mydomain.com [87.98.227.144] 143 (imap2) open

  • OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN AUTH=DIGE

And now the error:

consumer_1 | Starting document consumer at /consume
consumer_1 | [Errno -2] Name or service not known
consumer_1 | [Errno -2] Name or service not known

The error isnt so much descriptive :(

Anyone know anything about this??

Thx and best reggards.

@pitkley
Copy link
Member

pitkley commented Apr 27, 2016

Can you try to change the following from:

PAPERLESS_CONSUME_MAIL_HOST="mail.iteisa.com"
PAPERLESS_CONSUME_MAIL_USER="paperless@iteisa.com"
PAPERLESS_CONSUME_MAIL_PASS="******"

to:

PAPERLESS_CONSUME_MAIL_HOST=mail.iteisa.com
PAPERLESS_CONSUME_MAIL_USER=paperless@iteisa.com
PAPERLESS_CONSUME_MAIL_PASS=******

that is, removing the quotating-marks? I have had issues before with quotating-marks being part of the variable itself.

If your password contains spaces and further issues arise, you should also be able to quote the entire line:

"PAPERLESS_CONSUME_MAIL_PASS=******"

If this is in fact the issue, we should update the documentation regarding quotes!

@buhino
Copy link
Author

buhino commented Apr 27, 2016

It seems that quotating-marks were the problem.

Now consumer throw SSL message:

consumer_1 | [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:645)

I have changed the SSL in /usr/src/paperless/src/paperless/settings.py

MAIL_CONSUMPTION = {
"HOST": os.getenv("PAPERLESS_CONSUME_MAIL_HOST"),
"PORT": os.getenv("PAPERLESS_CONSUME_MAIL_PORT"),
"USERNAME": os.getenv("PAPERLESS_CONSUME_MAIL_USER"),
"PASSWORD": os.getenv("PAPERLESS_CONSUME_MAIL_PASS"),
"USE_SSL": False, # If True, use SSL/TLS to connect
"INBOX": "INBOX" # The name of the inbox on the server
}

But seems that the container inst able to apply the changes dynamically. Maybe because the consumer is in the infinite loop and dont listen the changes??. Is neccesary compile the python proyect??? Should i to build my own container with this change and restart the containers??

Thx

@buhino
Copy link
Author

buhino commented Apr 27, 2016

Finding a solution, seems that python to work with SSL need this module https://github.com/python-git/python/blob/master/Modules/_ssl.c

@danielquinn
Copy link
Collaborator

If you make changes to a config file, you have to restart the consumer. Otherwise, it won't know that anything has changed.

I also note that you've got USE_SSL = False set and that you're talking to an IMAP server on port 143. Servers running on that part should not be using SSL as IMAPs is typically reserved for port 993, while unencrypted transfers should happen over port 143. My advice is the following:

  • Determine if the IMAP server is using SSL on port 143 and/or if you can get a secure connection to it over port 993 instead.
  • Set USE_SSL = True
  • Restart the consumer

Note that by default most Python installations should have SSL enabled by default. In fact, it'd be very weird if it weren't installed that way, so your solution proposed here should not be necessary. Indeed, it should already be the case.

@pitkley
Copy link
Member

pitkley commented Apr 27, 2016

The issue is that the USE_SSL flag is not easily configurable for the Docker container.

I see two options:

  1. Add documentation on how to host-mount settings.py. This would be something like this in docker-compose.yml:

    services:
     ...
     consumer:
       ...
       volumes:
         ...
         - /path/to/local/settings.py:/usr/src/paperless/src/paperless/settings.py

    (The double src/paperless is not a typo.)

  2. Add another environment variable (PAPERLESS_CONSUME_MAIL_USE_SSL?).

@danielquinn
Copy link
Collaborator

Ah I see it now. Yes, the USE_SSL component is just hard-coded to True rather than using an environment variable like the rest. I guess the right thing to do in keeping with how things are currently setup is to go with #2 then. Gimme a few minutes :-)

@danielquinn
Copy link
Collaborator

I remember now why I didn't do this in the first place. Setting booleans via environment variables makes for ugly code. It should be working now though. @pitkley, do we need to add something to docker-compose.env.example or somewhere else?

@pitkley
Copy link
Member

pitkley commented Apr 28, 2016

@danielquinn Nope, nothing more needed. Thanks for implementing! 👍

@buhino An up-to-date Docker image is available from Docker Hub, simply docker pull pitkley/paperless. If you have built it from this repository, just git pull && docker build -t paperless ..

jonaswinkler pushed a commit to Skylinar/paperless that referenced this issue Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants