Closed phil-ittech closed 1 year ago
hi there @phil-ittech ! Have you checked if you can ping the Exchange server from within the docker container? Sometimes DNS resolving does not work with windows networks + docker. From past experience with Exchange, it might be required to pass an empty username/password combination and set email_sender. Also, NTML/Kerberos authentication will not work as your container is (probably) not joined to your domain.
@phil-ittech as per this function:
You will need to also specify the username EMAIL_HOST_USER
and password EMAIL_HOST_PASSWORD
Hello @matmair. Thank you for your reply, really appreciate it.
I have checked and I can ping the exchange server from the docker host and from the container directly. I can also telnet to the server on port 25.
I have added the following variables to the .env file, restarted the containers but with no luck.
INVENTREE_EMAIL_USERNAME INVENTREE_EMAIL_PASSWORD INVENTREE_EMAIL_TLS
A few of questons if I may:
python3 status.py
from within the container returns:root@f348c05495ce:/home/inventree/InvenTree/InvenTree# python3 status.py Traceback (most recent call last): File "/home/inventree/InvenTree/InvenTree/status.py", line 11, in <module> from django_q.models import Success File "/root/.local/lib/python3.9/site-packages/django_q/models.py", line 16, in <module> from django_q.conf import croniter File "/root/.local/lib/python3.9/site-packages/django_q/conf.py", line 31, in <module> class Conf: File "/root/.local/lib/python3.9/site-packages/django_q/conf.py", line 37, in Conf conf = settings.Q_CLUSTER File "/root/.local/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__ self._setup(name) File "/root/.local/lib/python3.9/site-packages/django/conf/__init__.py", line 63, in _setup raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Requested setting Q_CLUSTER, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Does the above give any clues please?
@SchrodingersGat - With regards to 'EMAIL_HOST_USER' and 'EMAIL_HOST_PASSWORD' - is this in addition to INVENTREE_EMAIL_USERNAME and INVENTREE_EMAIL_PASSWORD please?
Many Thanks in advance.
You have probably mis-configured your settings file, based on that error. Can you share a sanitized version here? Remove or redact any sensitive info.
The order is enviroment variable -> .env -> config.yaml -> database
Thank you both for your replies and help.
@SchrodingersGat - here are my .env and config.yaml files
InvenTree config yaml file.txt
Thank you in advance
Comprehensive docs for email setup are here - https://docs.inventree.org/en/latest/start/config/#email-settings
Unless you have removed the username and password values, they are empty in both your .env
and config.yaml
files (which is a problem)
Hi @SchrodingersGat. Thanks the reply.
Both username and password values have been left blank on purpose as InvenTree will be connecting to our exchange server on an internal receive connector as 'Anonymous users' (as this is internal use we don't require authentication).
Are you saying however that these variables NEED to be populated please?
I will populate these now and report back.
Thank you
Yes as per my link above in the is_email_configured
method, these fields must be filled.. Might be a bug, as it doesn't allow for anon logins
I have now authenticated with a domain user account and the 'Email Settings not configured' message has now gone from 'System Information'. Perfect.
However, I am now seeing SMTP authentication Server Error with the following data output
Traceback (most recent call last):
File "/home/inventree/InvenTree/InvenTree/forms.py", line 277, in send_mail
result = super().send_mail(template_prefix, email, context)
File "/root/.local/lib/python3.9/site-packages/allauth/account/adapter.py", line 140, in send_mail
msg.send()
File "/root/.local/lib/python3.9/site-packages/django/core/mail/message.py", line 284, in send
return self.get_connection(fail_silently).send_messages([self])
File "/root/.local/lib/python3.9/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
new_conn_created = self.open()
File "/root/.local/lib/python3.9/site-packages/django/core/mail/backends/smtp.py", line 69, in open
self.connection.login(self.username, self.password)
File "/usr/local/lib/python3.9/smtplib.py", line 750, in login
raise last_exception
File "/usr/local/lib/python3.9/smtplib.py", line 739, in login
(code, resp) = self.auth(
File "/usr/local/lib/python3.9/smtplib.py", line 662, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b'5.7.3 Authentication unsuccessful')
I will go off and troubleshoot this issue (as its likely to be something on my email server side) and report back as soon as I can to confirm what is going on here.
Thanks for your help with this.
I never even thought of anon mail servers, I have not had contact with non-cloud mail servers for years. @SchrodingersGat it might make sense to allow that. If I make a PR do you think we should merge?
To confirm, the SMTP authentication error was related to an incorrect receive connector on the exchange server that was not correctly setup to accept from 'Exchange Users' (i.e. authenticated users) from an internal source.
Email is all working now from Inventree.
Thanks to both of you @SchrodingersGat @matmair for your swift replies and help.
Looking forward to using this system. Great work guys!
Great to hear, can we close this?
Yes of course. Thanks!
I never even thought of anon mail servers, I have not had contact with non-cloud mail servers for years. @SchrodingersGat it might make sense to allow that. If I make a PR do you think we should merge?
I don't think it hurts to allow for this option. I'd be happy to merge
Deployment Method
Steps to Reproduce
Describe the problem*
Hello,
I am having issues configuring the email settings to connect to our on-prem exchange server.
I have configured the .env file with the following variables (Note - exchange does not require authentication internally)
INVENTREE_EMAIL_HOST INVENTREE_EMAIL_PORT INVENTREE_EMAIL_SENDER
However, when running the docker container, the 'System Information' screen reports that 'Email settings not configured. Under 'Global Settings' > 'Login Settings' a prompt shows at the top saying 'Outgoing email has not been configured. Some login and sign-up features may not work correctly!'
Apologies if I have missed something obvious in the documentation but I seem to be going round in circles currently. Any help that you could offer would be greatly appreciated. Thank you
Steps to Reproduce
docker compose down
docker compose up -d
Further steps (Apologies, these might be all guesses at this stage)
volume/inventree-data/config.yaml
to include host, port, sender, tls and ssl variables, however with no change.docker compose run inventree-server invoke update
Relevant log output
No response