Hi,
I’m trying to use Sendgrid email service and keep getting this error in the logs
Job exception: 535 Authentication failed: Bad username / password
I’m not sure what I’m doing wrong, here’s how my configuration looks like
DISCOURSE_SMTP_ADDRESS: smtp.sendgrid.net
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: apiKey
DISCOURSE_SMTP_PASSWORD: 'SG.xxxx.xxxxxx.xxxx'
I’ve also tried to use port 2525 on the suggestion of Fresh install. Works. Sendgrid not sending emails , but that didn’t work either.
I’m able to establish a connection using telnet.
Can someone please help? Any idea what I could be doing wrong?
Richie
(Richie Rich)
3. September 2019 um 20:58
2
From the same server that your Discourse is on?
Apologies if this is a silly question but is your SendGrid username actually: apiKey
I only ask, as it’s an unusual choice of account name…
Yes
No, I don’t think there’s a concept of username in sendgrid, I just followed the documentation here discourse/docs/INSTALL-email.md at main · discourse/discourse · GitHub
I might be wrong also, but I don’t see any username info in my sendgrid account.
Richie
(Richie Rich)
4. September 2019 um 08:16
4
They use different terminology but you’re still connecting to what is essentially a standard SMTP server, which will require authentication.
Go to the Teammates section - https://app.sendgrid.com/settings/teammates
In there you will see the account details that are able to send email:
The value in the “Username” column is what you need to enter in the Discourse setting DISCOURSE_SMTP_USER_NAME
So if the “Username” was SK2019 then you’d have something like:
DISCOURSE_SMTP_ADDRESS: smtp.sendgrid.net
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: SK2019
DISCOURSE_SMTP_PASSWORD: 'xxxx.xxxxxx.xxxx'
I tried that but didn’t work. The Sendgrid docs mention to use apiKey as username, but that doesn’t seem to be working.
Maybe I should reach out to the sendgrid team and seek their help.
Richie
(Richie Rich)
6. September 2019 um 19:47
6
Did you use apiKey when using telnet?
Yes, I followed instructions at How to Send an SMTP Email | SendGrid Documentation and they worked! Not sure what am I missing in discourse configuration.
Richie
(Richie Rich)
7. September 2019 um 19:55
8
Do the four lines in your config file look like mine (above )?
With the correct DISCOURSE_SMTP_USER_NAME that matches the one displayed in your Teammates page on SendGrid?
Yes, the username is the one displayed in the the Teammates page, the password is the key I generated (telnet works using this key), and other two fields are exactly the same.
May I know what version of discourse are you using, I’m using beta, I suspect that could be the issue.
Anyways, I’m planning to switching to mailgun, I tried it today, and it works seamlessly (though it’s expensive, but have no other options atm)
FWIW @Satwik_Kansal unser Sendgrid-API-Benutzername lautet “apikey” – nicht “apiKey”. Funktioniert einwandfrei.
ivan12
(IvanS)
27. September 2020 um 20:32
11
Ich habe das gleiche Problem. Was ist die Kernaussage hier? “apikey” verwenden (funktioniert nicht) oder ein Teammitglied hinzufügen (es ist leer)?
misterjtc
(Jordan Cook)
8. Oktober 2020 um 15:13
12
Für die Aufzeichnung: Die Dokumentation macht dies ziemlich verwirrend, und dies ist nicht das erste Mal, dass ich mich gezwungen sehe, genau dieses Problem bei Google zu suchen, um die Lösung zu finden.
Die Dokumentation enthält derzeit:
SendGrid — 40.000 E-Mails in einer 30-Tage-Testversion
SMTP-Serveradresse? smtp.sendgrid.net
SMTP-Benutzername? apikey
SMTP-Passwort? [SendGrid API-Schlüssel]
EDIT: Was meiner Meinung nach die Leute verwirrt (wie mich), ist, dass sie denken, „apikey
Richie
(Richie Rich)
15. Oktober 2020 um 20:11
13
misterjtc:
Was die Leute verwirrt, ist, dass sie (wie ich) denken, apikey bedeute, hier deinen API-Schlüssel einzufügen.
Verrückt, oder?
Ich würde sagen, das hat 99 % der Leute, die es versuchen, verwirrt
(mich damals eingeschlossen)