plankanban / planka

The realtime kanban board for workgroups built with React and Redux.
https://planka.app
GNU Affero General Public License v3.0
7.25k stars 675 forks source link

SMTP no work #649

Open DeAlexPesh opened 3 months ago

DeAlexPesh commented 3 months ago

When should letters send? No error, but and no letters...

SMTP_HOST=smtp.yandex.ru
SMTP_PORT=465
SMTP_SECURE=true
SMTP_USER=user@domain.ru
SMTP_PASSWORD=PaSsWoRd
SMTP_FROM=user@domain.ru
meltyshev commented 3 months ago

For now, emails are sent if you are subscribed to a card and that card has been moved to another list or a comment has been left on it. No other notification have been added yet, but we plan to finalize them.

tomlyo commented 3 months ago

I was testing this for a while until I realized they wouldn't send when you're commenting on your own cards. Impersonated another user to test and all was well.

DeAlexPesh commented 3 months ago

but we plan to finalize them.

DeAlexPesh commented 3 months ago

Impersonated another user to test and all was well.

hm. no work for another user...

casem commented 3 months ago

It's not working for me either. I can see in the planka logs the following whenever I comment on a card: 2024-03-27 22:41:17 [E] undefined

meltyshev commented 3 months ago

It's not working for me either. I can see in the planka logs the following whenever I comment on a card: 2024-03-27 22:41:17 [E] undefined

Hm, that's weird, for some reason Nodemailer doesn't throw an error in your case, but when I'm trying with wrong settings, the error is displayed correctly.

try {
  const info = await transporter.sendMail({
    ...inputs,
    from: sails.config.custom.smtpFrom,
  });

  sails.log.info('Email sent: %s', info.messageId);
} catch (error) {
  sails.log.error(error); // <- Here
}
casem commented 3 months ago

Hm, that IS weird. I believe I have it set up correctly by using the docker compose in the repo as an example but since I’m not getting a detailed error, I can’t tell what’s wrong.

sabbath88 commented 2 months ago

Have same issue. I am trying to play with notifications, but no single was sent. I am using 1.16.3 (no docker)

2024-04-11 10:40:44 [E] undefined
2024-04-11 10:52:05 [E] undefined
meltyshev commented 2 months ago

I'll try testing again to catch this undefined error.

casem commented 2 months ago

After a bit of testing, I've been able to send an email using SendGrid's SMTP server but not the Google Workspace SMTP server. I've tried using the Google Workspace SMTP server as well as their SMTP Relay and both give the [E] undefined error.

shakibait commented 2 months ago

I faced same error in docker and tested with Google workspace, yandex, SendGrid smtp services. Docker container error log for each action shows: 2024-04-11 20:34:51 [E] undefined 2024-04-11 20:34:52 [E] undefined

meltyshev commented 2 months ago

I tried running Planka in docker with SMTP settings and got the same error. According to this answer we need to add another environment variable SMTP_NAME, so that the hostname can be specified when running via docker.

casem commented 2 months ago

I managed to get Google Workspaces working without any docker changes. I had to make a chance to my Google Account Security and turned on "less secure app access".

meltyshev commented 2 months ago

Adding SMTP_NAME doesn't seem to change anything.

For some reason, the settings that I tested before and everything worked, now don't work and the same error occurs. But it seems to be a problem related to the specified SMTP_HOST, maybe they're just blocking connections because of frequent attempts.

Also found why undefined is output, for some reason logging in sails works differently in production (probably it's a bug). I changed the logging messages a bit and the error is displayed the same everywhere. I'll make a release with this fix.

meltyshev commented 2 months ago

Please try upgrading to 1.16.4 and you'll see a normal error message instead of undefined.

shakibait commented 2 months ago

I did something and start to get email notifications without any problem, BUT i'm not sure it's correct or not to set SMTP_SECURE=false. Kindy request to know if help contributers to solve it in better way maybe. Right now i'm using Google workspace and also tested yandex mail without any problem and notifications are coming.

mostdcoa commented 2 months ago

I was testing this for a while until I realized they wouldn't send when you're commenting on your own cards. Impersonated another user to test and all was well.

Wow, this would have been nice to know, spent hours trying to troubleshoot this!

I am also having issues with SMTP, I do have an error:

planka-1 | 2024-04-13 14:14:16 [E] Error sending email: Error: D809414AB67F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:

I am using google workspace-

As @shakibait mentioned, I also disabled SMTP_SECURE=false and it sends email without any issues.

DrPersico commented 2 months ago

Wow, this would have been nice to know, spent hours trying to troubleshoot this!

I am also having issues with SMTP, I do have an error:

planka-1 | 2024-04-13 14:14:16 [E] Error sending email: Error: D809414AB67F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:

I am using google workspace- - SMTP_HOST=smtp.gmail.com (i've tried smtp-relay.gmail.com as well) - SMTP_PORT=587 - SMTP_SECURE=true - SMTP_USER=planka@customdomain.com - SMTP_PASSWORD=application password - SMTP_FROM="Planka" planka@customdomain.com

As @shakibait mentioned, I also disabled SMTP_SECURE=false and it sends email without any issues.

The reason why it's working with SMTP_SECURE=false and not with it set to true is because of port 587 which does not accept SSL. Changing the port to 465 should solve the issue. I highly recommend also setting the name in nodemailer as mentioned previously:

I tried running Planka in docker with SMTP settings and got the same error. According to this answer we need to add another environment variable SMTP_NAME, so that the hostname can be specified when running via docker.

mostdcoa commented 2 months ago

@DrPersico

Thanks, this solved my issue.

For anybody else looking at this in the future:

tomlyo commented 2 months ago

This has been working well, but I've been getting complaints about not being able to turn off the email notifications on the end user side. I will have to disable the feature entirely I think.

meltyshev commented 2 months ago

This has been working well, but I've been getting complaints about not being able to turn off the email notifications on the end user side. I will have to disable the feature entirely I think.

Thanks for the idea, should be easy to implement.