Hoppa till innehållet

Apps

Keycloak

Send the mail that Keycloak writes to its users, such as password resets and requests to verify an address, through Sendora’s SMTP. Each realm has its own email settings, so enter them in every realm that sends mail.

Before you start

  • A Sendora account. A test server works from the moment the account exists. A live server sends once your account is approved. The account starts on Free, within the limits that Account › Usage in the dashboard shows.
  • Access to the DNS of the domain that Keycloak’s mail comes from.
  • An administrator’s access to the realm in Keycloak’s admin console.

Set up Keycloak

  1. Add the domain that Keycloak’s mail comes from under Domains, and add the two DNS records it shows, as Domains explains.
  2. Create a test server under Servers › New server, with Testserver ticked, and create a key on its API keys tab. The key starts with sk_test_. A test server takes mail as a live server does and delivers none of it.
  3. In Keycloak’s admin console, choose the realm, then open Realm settings and its Email tab. Enter Sendora’s values:
FieldValue
FromAn address on your verified domain, such as no-reply@example.se
From display nameThe name your users see, such as your app’s
Envelope fromEmpty. Sendora sets the envelope sender itself, so that bounces reach it
Hostsmtp.sendora.se
Port465
EncryptionTick Enable SSL, and leave Enable StartTLS unticked
AuthenticationOn, with Authentication Type set to Password
UsernameThe server key
PasswordThe server key
Allow UTF-8Off, since Sendora takes addresses in ASCII only

Port 587 works too, with Enable StartTLS ticked instead of Enable SSL. If Keycloak runs on a host that blocks ports 465 and 587, such as a DigitalOcean Droplet, use port 2525 in the same way.

  1. Click Save.
  2. Click Test connection, which sends a message to the address of the administrator you are signed in as. If the button stays disabled, send a message to a user instead. On the user’s Credentials tab, click Credential Reset, choose a reset action and click Send Email.
  3. Find the message on the server’s Messages tab under Servers.
  4. Once your account is approved, create a key on your live server’s API keys tab, such as the default server that signup made. Put it in Username and Password in place of the test key, and click Save.

If a message is refused

When Sendora refuses a message, Keycloak logs Failed to send email with Sendora’s reply, and Test connection shows Error! Failed to send email. 535 5.7.8 means the key is wrong or revoked. 550 5.7.1 means the From domain is not verified, or that a live server’s account is not yet approved. 451 4.7.0 means that a limit is reached, such as Free’s daily limit. 550 5.1.1 means the recipient’s address is on the suppression list, for example after a hard bounce. SMTP replies lists every reply.

Test the setup

On the server’s API keys tab under Servers, Test the setup shows each valid key’s latest sign-in and accepted message over SMTP. It also shows the key’s latest refusals, each with what to do. After Keycloak sends a message, click Check now.