Configuring SMTP Mail notifier for Statping
-
-
Oh I guess this got moved, good to know
The error code is from the Cloudron Mail tab or from the Statping app?
-
@brutalbirdie error is from statping backend when adding (and testing) smtp info:
-
@chris looks to be some bug in the app. Unfortunately, there are many issues with the app and others have also requested that this app be marked as unstable (https://forum.cloudron.io/topic/4106/mark-this-app-as-unstable/). To add to it, the upstream author is not responding much either about bug reports we raised.
So, I don't have a good answer other than to not use this app for the moment until we find some time to fix the issues. I am looking into publishing phpservermonitor in the next few days (since @msbt has already packaged it).
-
@chris Oh, I just noticed that the SMTP Host is not correct. It should be
mail
and notmy.domain.com
. This is because the port 2465 is only exposed internally and not exposed externally.Can you try these and let me know what works (same username and password as above):
- SMTP Host:
mail
and Port 2465 - SMTP Host:
mail
and Port 2525 - SMTP Host:
my.xx.net
and Port 587 <-- I expect this to definitely work since you say sendgrid worked
BTW, Where did you get the SMTP Username and Password from? Did you just create a mailbox (if so, that is the correct way) or from the environment variables (this is also correct).
- SMTP Host:
-
@girish i followed @BrutalBirdie notes from this forum post
running
printenv
from within terminal to see user/pass/port info. let me try your suggested edits now... -
@chris thanks for testing. I found the reason why it won't connect to port 587. It's because when a connection is "internal", Cloudron won't offer STARTTLS. This makes Go reject the connection as unencrypted. This is the reason why we had made port 2465 in the first place but that doesn't work for some reason. Debugging...
-
@girish thanks for looking deeper into this, hopefully the fix is easy.
while testing various SMTP out configs, i also thought i would integrate twilio, i already have twilio accounts, so putting in the Account SID and Token was easy, and worked, but when i put the phone number in and saved, i got an error, status code 422. will open new forum post on this one to keep this one related to SMTP.
-
OK, decided to look into this to see if it's something obvious.
The testing logic is here https://github.com/statping/statping/blob/1a56afe7f76403ad8f839a45de02b2715370eb6c/notifiers/email.go#L137 which in turn just calls into https://github.com/statping/statping/blob/1a56afe7f76403ad8f839a45de02b2715370eb6c/notifiers/email.go#L155 . By my reading, SSL will be set to false (ApiKey is curious use of some random db field it seems). Which then lands in an unmaintained go module - https://github.com/go-mail/mail/blob/v2/smtp.go . The default for StartTLS in the package is opportunistic - https://github.com/go-mail/mail/blob/v2/smtp.go#L163 , so it should all just work but clearly doesn't
-
Thanks for taking another look into this @girish - the maintainer seems unwilling/unable to address the issue you raised on github. For now using a third party SMTP is working fine with this app (sendgrid) but i would love if this apps twilio support (SMS) support, worked... as its tands i cant get that working either. in any case, looking into the new app on cloudron you just added: https://forum.cloudron.io/category/126/php-server-monitor as it providers similar features.
-
After much Go code spelunking:
I guess a fix has to be made to statping but generally I prefer changing the platform to adapt to the app unless it's an outright bug. So, I am going to see if I can fix our mail server.
Notes to future me:
- statping always sets mailer.SSL to fase. This means port 2465 can never work
- Ultimately, go-mail in turn uses net/smtp which won't send passwords with TLS