Dear Team,
We are using
Sendgrid as SMTP server to send emails from Gerrit. Recently Sendgrid made 2FA mandatory for authentication. Previously we were using Sendgrid username and password to authenticate from Gerrit. After the mandatory 2FA, sendgrid suggests to use username as "apikey" and password as a token.
After updating our gerrit.config file with username and token we are getting the below error
Below is the sendemail configuration we are using
[sendemail]
enable = true
smtpEncryption = ssl
smtpUser = apikey
smtpPass = <sendgrid token>
smtpServerPort = 465
By the way when we used below curl command from the same machine where our gerrit server is hosted and we received the emails.
curl -i --request POST \
--header 'Authorization: Bearer <sendgrid token>' \
--header 'Content-Type: application/json' \
--data '{"personalizations": [{"to": [{"email": "te...@gmail.com"}]}],"from": {"email": "GerritCodeReview <coder...@test.com>"},"subject": "Hello, World!","content": [{"type": "text/plain", "value": "Howdy!"}]}'
For the record the same token is being used in other tools(viz., Jenkins etc) of our organisation and things are working with the username and token.