makeplane / plane

šŸ”„ šŸ”„ šŸ”„ Open Source JIRA, Linear, Monday, and Asana Alternative. Plane helps you track your issues, epics, and product roadmaps in the simplest way possible.
http://plane.so
GNU Affero General Public License v3.0
30.46k stars 1.7k forks source link

[bug]: Mail not sending, no errors even without proper SMTP configuration #3980

Open Reloecc opened 7 months ago

Reloecc commented 7 months ago

Is there an existing issue for this?

Current behavior

I am currently debugging our self-hosted Plane app, using setup.sh to start it. We utilize Docker. Plane is currently version 0.16, although I upgraded from 0.14.2 hoping to resolve the issue, but it didn't help.

I'm encountering a problem with sending emails from within the Plane app, such as member invitations and password resets. I'm confident that my credentials are correct, and the SMTP server is operational. Other services on the server can successfully use the SMTP server. I even accessed Plane's Docker containers via bash to ensure my credentials are properly set as environment variables.

The real issue here is that I have no idea how to debug this behavior. I've set debug=1 in .env, but there are no relevant reports in the Docker logs. The core of the debugging process lies in the fact that I don't see any errors even if I unset the relevant environment variables or enter nonsense values. Plane still notifies me with "Invitations sent successfully."

Is it normal for the Plane not to check for SMTP errors and not present them to the frontend or log them?

In addition to user, host, etc., my settings currently look like this, but I've also tried ports 465 and 25 (as my SMTP server supports them) without TLS and with SSL. However, I was not successful in resolving this issue.

Please help.

EMAIL_PORT=587
EMAIL_USE_TLS=1
EMAIL_USE_SSL=0

Steps to reproduce

1) setup no env variables for EMAIL_HOST in .env 2) send invitation e-mail

Environment

Production

Browser

Other

Version

Self-hosted

ToolReaz commented 7 months ago

Hello,

I have the exact same problem as you. I tested on the same version and I'm also self-hosting with Docker. I tested my SMTP configuration with other tools and even a basic script using nodemailer and it works fine.

Reloecc commented 7 months ago

Hello,

I have the exact same problem as you. I tested on the same version and I'm also self-hosting with Docker. I tested my SMTP configuration with other tools and even a basic script using nodemailer and it works fine.

I have no update on this issue. Our plane is not very usable right now because of this. I can add we had smtp working on 0.14.2 before, with smtp server on the same server as plane were running on. We migrated smtp server and I was not able to connect plane to it. Without ANY error messages.. it's not possible to know what's wrong :/.

ToolReaz commented 7 months ago

I found in this issue's comment someone giving a command to test email. I entered in api's container shell to try but the command failed:

6d162933608f:/code$ python manage.py test_email "<email>"
Unknown command: 'test_email'. Did you mean sendtestemail?

So i tried the recommended command and got the following error:

6d162933608f:/code$ python manage.py sendtestemail "<email>"
Traceback (most recent call last):
  File "/code/manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/sendtestemail.py", line 35, in handle
    send_mail(
  File "/usr/local/lib/python3.11/site-packages/django/core/mail/__init__.py", line 87, in send_mail
    return mail.send()
           ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/mail/message.py", line 298, in send
    return self.get_connection(fail_silently).send_messages([self])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 127, in send_messages
    new_conn_created = self.open()
                       ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 85, in open
    self.connection = self.connection_class(
                      ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 341, in connect
    self.sock = self._get_socket(host, port, self.timeout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 312, in _get_socket
    return socket.create_connection((host, port), timeout,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
    sock.connect(sa)
OSError: [Errno 99] Address not available

I continue to investigate...

mguptahub commented 7 months ago

@Reloecc @ToolReaz

Hope you guys have followed the instructions available on docs to setup smtp configuration

Reloecc commented 7 months ago

@Reloecc @ToolReaz

Hope you guys have followed the instructions available on docs to setup smtp configuration

1) Are you saying .env configuration is not used (anymore?)? 2) It's still not convient that Plane gives no errors.

Thank you.

mguptahub commented 7 months ago

@Reloecc

All the SMTP configuration have been moved to GOD MODE.

After 1st time setup of application / db initalization, SMTP configuration from ENV will get saved in DB for further use. Later on user can modify the SMTP settings from God Mode screens. This means that SMTP env changes after 1st setup , will not be picked by application.

Reloecc commented 7 months ago

After 1st time setup of application / db initalization, SMTP configuration from ENV will get saved in DB for further use.

Well.. that explains a thing. Thank you. My bad then on this point.