So if the openssl test works but the connection test run by discourse-doctor still fails when using those settings what is next? Even though the openssl test works my discourse connection still fails with 504 5.7.4 Unrecognized authentication type… Presumably it is not recognizing the LOGIN auth method. I tried adding DISCOURSE_SMTP_AUTHENTICATION: login to the app.yml file, but that has not helped.
FWIW, here is what I have found. I went into the docker image and started monkeying around with the lib/tasks/emails.rake script and the config/discourse.conf file. Several hours later, after trying every possible combination of smtp.office365.com and .mail.protection.outlook.com AUTH login and AUTH plain I uncommented the block above the STMP start.
# We would like to do this, but Net::SMTP errors out using starttls
#Net::SMTP.start(smtp[:address], smtp[:port]) do |s|
# s.starttls if !!smtp[:enable_starttls_auto] && s.capable_starttls?
# s.auth_login(smtp[:user_name], smtp[:password])
#end
Running that as-is resulted in a read timeout.
Modifying it like this - calling new rather than start resulted in a successful send.
Net::STMP.new(smtp[:address], smtp[:port]) do |s|
s.enable_starttls
s.auth_login(smtp[:user_name], smtp[:password])
end
This is my first exposure to Ruby, rake and friends. I can’t explain why it works or if is a ‘good thing’ for general cases.
J.
Ich nutze socketlabs.com als E-Mail-Versanddienst und hatte ein ähnliches Problem. In meinem Fall bestand die Lösung darin, die Datei lib/tasks/emails.rake wie folgt zu bearbeiten:
Ändern Sie die Zeile: Net::SMTP.start(smtp[:address], smtp[:port], 'localhost', smtp[:user_name], smtp[:password])
in: Net::SMTP.start(smtp[:address], smtp[:port], 'localhost', smtp[:user_name], smtp[:password], smtp[:authentication])
Ohne diese Änderung wird DISCOURSE_SMTP_AUTHENTICATION: login nicht an den darunterliegenden SMTP-Code übergeben.
Ich habe nicht getestet, ob der geänderte Code auch für andere Authentifizierungsmethoden funktioniert, aber er behebt das Problem bei der login-Authentifizierung.
Ich kann bestätigen, dass das Hinzufügen von smtp[:authentication]
zum Net::SMTP.start-Aufruf und das Setzen von DISCOURSE_SMTP_AUTHENTICATION: login
in app.yml das Problem auf der E-Mail-Testseite behebt.
Ich gehe davon aus, dass reguläre E-Mails über die mail-Bibliothek gesendet werden und das Setzen von DISCOURSE_SMTP_AUTHENTICATION: login
in app.yml für die korrekte Funktionsweise der Bibliothek ausreicht.
Dennoch bin ich der Meinung, dass lib/tasks/emails.rake so angepasst werden sollte, dass es die Einstellung DISCOURSE_SMTP_AUTHENTICATION verwendet. Dies würde einige unnötige Fehlersuche einsparen.
Als allgemeines Update zu diesem Thema: MS entfernt gerade die veraltete Authentifizierung für SMTP und POP3, was die Sache erschweren wird, wenn Sie O365 als E-Mail-Anbieter nutzen. Die derzeit angewendete Standardrichtlinie verbietet SMTP AUTH, und Sie müssen dies pro Postfach aktivieren. Ich hoffe, das ist hilfreich – ich habe gestern Morgen stundenlang gegen diese Wand gelaufen.
Besonders schade ist das für POP, denn die Einrichtung von eingehender E-Mail wird deutlich schwieriger, es sei denn, Discourse fügt IMAP-Unterstützung für eingehende Postfächer hinzu.
Es gibt eine einfache Lösung für eingehende E-Mails, die einen Container zum Empfangen enthält. Früher hieß sie ‘einfach’, aber jemand hat den Namen beanstandet, er wurde geändert, und ich kann ihn nicht mehr finden.