8000 Send SMTP with Gmail (was: SMTP Port lost after update?) · Issue #3529 · wekan/wekan · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Send SMTP with Gmail (was: SMTP Port lost after update?) #3529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
adelphi-company opened this issue Feb 5, 2021 · 32 comments
Closed

Send SMTP with Gmail (was: SMTP Port lost after update?) #3529

adelphi-company opened this issue Feb 5, 2021 · 32 comments

Comments

@adelphi-company
Copy link

Server Setup Information:

  • Did you test in newest Wekan?: yes
  • Wekan version: 4.92.0
  • Operating System: Debian
  • Deployment Method(snap/docker/sandstorm/mongodb bundle/source): snap
  • Wekan only works on newest desktop Firefox/Chromium/Chrome/Edge/Chromium Edge and mobile Chrome. What webbrowser version are you using?: chrome 88

Problem description:

We have configured SMTP port 25 which is correctly shown in the admin GUI but if we click "Test email" we get an error showing port :587.
To fix it, we have to enter Port 587 -> save -> enter 25 -> save and it will temporarily work again. But it seem that wekan automatically falls back to 587 after an update so we have to fix it almost every day....

@ClaudiaK21
Copy link

We have this problem too and receive no E-Mail notifications anymore, because the IT cannot fix it everyday. So is there a solution?

@jrsupplee
Copy link
Contributor

Looks like the problem is here in settings.js:

  Meteor.startup(() => {
    ...
    const newSetting = Settings.findOne();
    if (!process.env.MAIL_URL && newSetting.mailUrl())
      process.env.MAIL_URL = newSetting.mailUrl();
    ...
  });

If you have a MAIL_URL environment variable defined it will always override the setting from the database.

So when you update the SMTP information it overrides the MAIL_URL specified on the command line until the next restart of the server.

@xet7
Copy link
Member
xet7 commented Mar 2, 2021

@jrsupplee

Cool, nice find !

@jrsupplee
Copy link
Contributor

@xet7

To me it seems reasonable that environment variables override the program settings.

@xet7
Copy link
Member
xet7 commented Mar 2, 2021

Yes.

@jrsupplee
Copy link
Contributor

@xet7

There should probably be a notice in the admin panel that the email settings are being overridden by an environment variable.

@xet7 xet7 closed this as completed in 65b8220 Mar 2, 2021
@xet7
Copy link
Member
xet7 commented Mar 2, 2021

@jrsupplee

STMP settings are not anymore visible at Admin Panel on non-Sandstorm platforms. There is only "Send test email" button.

@xet7
Copy link
Member
xet7 commented Mar 2, 2021

@adelphi-company @ClaudiaK21

Please test does now snap set wekan mail... settings keep working.

@adelphi-company
Copy link
Author

I can confirm fix in 5.02. Thank you!

@xet7
Copy link
Member
xet7 commented Mar 2, 2021

Wow cool, great it works!!!!

@ClaudiaK21
Copy link

Yeah, it works again, we, who use WEKAN are very very happy now - thank you ;-)

@L25inux
Copy link
L25inux commented Mar 7, 2021

I have problem set email from console now :( When I try send test email there is ECONNREFURED 127.0.1.1.587 error.
My command is: sudo snap set wekan mail-url='smtps://wekan%40ourdomain.com:password@smtp.gmail.com:587'

It should be OK or there is mistake from my side? :) Thank you very much for help :)

@xet7
Copy link
Member
xet7 commented Mar 7, 2021

@L25inux
Copy link
L25inux commented Mar 7, 2021

Yes I read it but it not work :) So I posted here my problem. Can you help me?

@jrsupplee
Copy link
Contributor

I have problem set email from console now :( When I try send test email there is ECONNREFURED 127.0.1.1.587 error.
My command is: sudo snap set wekan mail-url='smtps://wekan%40ourdomain.com:password@smtp.gmail.com:587'

It should be OK or there is mistake from my side? :) Thank you very much for help :)

Might need a slash (/) on the end. Not sure how picky it is about that.

@xet7
Copy link
Member
xet7 commented Mar 7, 2021

@L25inux

Please check logs. Are there any errors?

sudo snap set wekan debug='true'

sudo snap logs wekan.wekan

If there are any errors, check for solutions from:
https://github.com/wekan/wekan/wiki/Troubleshooting-Mail

If you really would like to use Gmail to send, please check Gmail settings at https://myaccount.google.com/security

  • Allow less safe applications using Gmail
  • Allow IMAP/SMTP
  • Create 3rd party email client password for Wekan
  • Check that Gmail does not block sending email
  • Also note that Gmail does have rate limits in sending email and block your email

I would recommed using AWS SES or some other email sending instead:
https://github.com/wekan/wekan/wiki/Troubleshooting-Mail

@xet7
Copy link
Member
xet7 commented Mar 7, 2021

I really don't know does Gmail allow sending with it via SMTP. At least Thunderbird requires extra OIDC authentication.

@L25inux
Copy link
L25inux commented Mar 8, 2021

FIXED! :) and yes GMAIL allow sending with it via SMTP. SMTP server is smtp.gmail.com
IF you need it correct setup is:
sudo snap set wekan mail-url='smtps://username@domain.com:password@smtp.gmail.com:465'
Convert password via this service https://www.url-encode-decode.com and everything will work.

@buttermilchmensch
Copy link
buttermilchmensch commented Sep 10, 2021

FIXED! :) and yes GMAIL allow sending with it via SMTP. SMTP server is smtp.gmail.com
IF you need it correct setup is:
sudo snap set wekan mail-url='smtps://username@domain.com:password@smtp.gmail.com:465'
Convert password via this service https://www.url-encode-decode.com and everything will work.

Hey, does this still work? I get the error message:

Invalid login: 535-5.7.8 
Username and Password not accepted. Learn more at 
https://support.google.com/mail/?p=BadCredentials

I tested:

  1. snap set wekan mail-url='smtps://username@gmail.com:password-encoded@smtp.gmail.com:465'
  2. snap set wekan mail-url='smtps://username%40gmail.com:password-encoded@smtp.gmail.com:465'
  3. snap set wekan mail-url='smtps://username@gmail.com:password-not-encoded@smtp.gmail.com:465'
  4. snap set wekan mail-url='smtps://username%40gmail.com:password-not-encoded@smtp.gmail.com:465'

And nothing is working. :(

@xet7 xet7 reopened this Sep 10, 2021
@xet7 xet7 changed the title SMTP Port lost after update? Send SMTP with Gmail (was: SMTP Port lost after update?) Sep 10, 2021
@xet7
Copy link
Member
xet7 commented Sep 10, 2021

@buttermilchmensch

Well, I don't know is it really a good idea to send email with gmail, because you can too easily get blocked because of so many sent emails, Gmail thinking it's spam. Please do not use any critical email address that you have not backed up first with https://takeout.google.com .

You could try with new MAIL_SERVICE settings:

sudo snap set wekan mail-service='Gmail'
sudo snap set wekan mail-service-user='firstname.lastname@gmail.com'
sudo snap set wekan mail-se
8000
rvice-password='SecretPassword'

With these, you may also need MAIL_URL (or not), and MAIL_FROM.

It could maybe also work with Google Workplace with custom domain.

Not tested. YMMV.

@xet7
Copy link
Member
xet7 commented Sep 10, 2021

There will be later feature to group emails to one email, or have summary emails, but it's not ready yet.

@buttermilchmensch
Copy link

Thanks for the fast answer.
Yes, I'm aware of the risk of being blocked. So I used an unimportend mail account.
With the MAIL_SERVICE settings I get the message:
Email sent: xxx@yyy.com
But I don't receive anything ...
I'm trying to find the mistake and will get in touch later on.

@ManZosh
Copy link
ManZosh commented Sep 13, 2022

Thanks for the fast answer. Yes, I'm aware of the risk of being blocked. So I used an unimportend mail account. With the MAIL_SERVICE settings I get the message: Email sent: xxx@yyy.com But I don't receive anything ... I'm trying to find the mistake and will get in touch later on.

Hi @buttermilchmensch, did you ever get Gmail SMTP to work on WeKan?? I've tried both mail-url and mail-service and nothing I try works... We have a variety of other web applications using the same Gmail SMTP config so dunno what my issue might be...
image

Everytime it's a connection timeout.

Confirmed the port is open, this VM's UFW is disabled, Gmail 'Less Secure Apps' access is on. Nothing regarding SMTP ever outputs to the WeKan log. We are nowhere near the limit on this Gmail account. And IMAP/SMTP is enabled on this email account as like I mentioned other web apps use it successfully.

Any ideas?

@xet7
Copy link
Member
xet7 commented Sep 13, 2022

I don't recommend configuring SMTP for Meteor WeKan, it can easily send hundreds of notifications messages, like spam, there is not yet feature for combining notifications.

AWS SES works for SMTP, if someone anyway likes to use it.

@ManZosh
Copy link
ManZosh commented Sep 13, 2022

Hmmm we're a very small IT team, I guess I should ask what prompts a WeKan email notification? We really would just like it to email someone if their username is mentioned on a board.

@xet7
Copy link
Member
xet7 commented Sep 14, 2022

There are many different kind of notifications in many places currently, some info is at wiki, docker-compose.yml, snap settings, notification tray, user settings, etc. I will add better Notifications Settings #2026 that will combine all to same page more clearly, and make sure it actually works like those settings. After that, it will be easier to answer how it actually works.

@xet7
Copy link
Member
xet7 commented Sep 14, 2022

Current notifications related bugs etc are listed at https://github.com/wekan/wekan/issues?q=is%3Aopen+is%3Aissue+label%3AFeature%3ANotifications

Sorry, something went wrong.

@buttermilchmensch
Copy link
buttermilchmensch commented Sep 14, 2022

Hi @buttermilchmensch, did you ever get Gmail SMTP to work on WeKan?? I've tried both mail-url and mail-service and nothing I try works... We have a variety of other web applications using the same Gmail SMTP config so dunno what my issue might be... image

Hi @ManZosh,
no, we don’t use the mail notification at the moment because it didn’t run on our system and we did not have the time to test it with several configurations. Sorry.

@xet7
Copy link
Member
xet7 commented Sep 14, 2022

Using AWS SES works currently, I think:
https://github.com/wekan/wekan/wiki/Troubleshooting-Mail#example-aws-ses

@ManZosh
Copy link
ManZosh commented Sep 14, 2022

I will add better Notifications Settings #2026 that will combine all to same page more clearly, and make sure it actually works like those settings. After that, it will be easier to answer how it actually works.

Current notifications related bugs etc are listed at https://github.com/wekan/wekan/issues?q=is%3Aopen+is%3Aissue+label%3AFeature%3ANotifications

My organization has a budget for working with the Open-Source community, since we self-host so many FOSS apps in an enterprise capacity. How many support/sponsorship hours would you guesstimate for implementing atleast a basic level of email and/or browser notifications to Meteor/Snap WeKan users?

@xet7
Copy link
Member
xet7 commented Sep 14, 2022

@frezik
Copy link
frezik commented Mar 18, 2023

With a GSuite domain, I was able to get it working by following the top instructions here:

https://support.cloudways.com/en/articles/5131076-how-to-configure-gmail-smtp

In short, enable 2FA on the account, then setup an app password on https://security.google.com/settings/security/apppasswords. Use the password generated as the app password to set mail-service-password. You have to have 2FA on or the app password won't work.

It would be nice if wekan could support the Gmail API directly. In my experience with other apps, Gmail doesn't like people going through the SMTP server at all, and has made it more and more difficult over the years. Wouldn't be surprised if they just turn it off one day.

@xet7 xet7 closed this as completed Nov 21, 2023
@xet7 xet7 closed this as completed Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants
0