souramoo / commentoplusplus

Commento with out of the box patches and updates to add useful features and fixes. Also with one-click deploy to Heroku so you can get up and running fast.
MIT License
389 stars 62 forks source link

unable to send mails using STARTTLS #133

Open Loosetooth opened 1 year ago

Loosetooth commented 1 year ago

Currently, it is impossible to send mails using STARTTLS, I get the following error in the logs:

2022/10/21 11:40:20 [ERROR] smtp_email_notification.go:48 smtpEmailNotification(): cannot send email notification email: 530 Must issue a STARTTLS command first.

The fix is relatively straightforward, in smtp_send.go the following line needs to be added when using STARTTLS:

server.Encryption = mail.EncryptionSTARTTLS

I will try to make a pull request to add the fix.

tealaforgia commented 1 year ago

I have a similar problem (Docker). With the original Commento there is no problem with the same configuration. I use Zoho mail. My configuration:

COMMENTO_SMTP_HOST=smtp.zoho.eu
COMMENTO_SMTP_PORT=587
COMMENTO_SMTP_USERNAME=[myzohousername]
COMMENTO_SMTP_PASSWORD=[REDACTED]
COMMENTO_SMTP_FROM_ADDRESS=commento@domain.com

The error, when i try to reset password, is:

2022/10/25 13:24:55 [ERROR] smtp_reset_hex.go:19 smtpResetHex(): cannot send reset email: 530 Must issue a STARTTLS command first.
souramoo commented 1 year ago

Have just merged this fix! @tealaforgia please try the latest docker image, with USE_STARTTLS=true

tealaforgia commented 1 year ago

Thanks, now the bug seems to be fixed.Email are sended correctly with my configuration.

Brawl345 commented 1 year ago

@tealaforgia Sorry to bother you but how did you get it working with Zoho? I have used the exact same configuration as yours (but with .com) but I'm getting:

[ERROR] smtp_reset_hex.go:19 smtpResetHex(): cannot send reset email: 553 Relaying disallowed as @

This is my config:

COMMENTO_SMTP_HOST=smtp.zoho.com
COMMENTO_SMTP_PORT=587
COMMENTO_SMTP_USERNAME=my.account@zoho.com
COMMENTO_SMTP_PASSWORD=mypassword
COMMENTO_SMTP_FROM_ADDRESS=no-reply@otherdomain.com

I also have "no-reply@otherdomain.com" configured in Zoho as alias. Note that I'm using the latest release not the latest commit, but at least I should get the STARTTLS error first, no? I've also tried the same FROM address as the login name. I have two factor auth enabled but created an app password - the same config works with Vaultwarden so no idea what the problem is. Maybe I overlooked something? 🤔

Brawl345 commented 1 year ago

Ok I had to use the latest commit then everything worked plus the above issue was fixed. Of course USE_STARTTLS must be true.

ugurkocde commented 11 months ago

SMTP only worked for me after adding this variable:

USE_STARTTLS = true