Kratos SMTP configuration issue: can not use credentials with slashes

I am really happy that our integration with the Ory environment (Kratos, Oathkeeper, Hydra, Keto) working smoothly.

Now since we are ready to go live, we will use AWS SES for the email service. As far as I know, Kratos works with SMTP connection, so we prepare the SMTP configuration on SES, and yeah normally the credentials contain forward slashes.

The issue is the Kratos container is failed with an error that can not parse the SMTP URL configuration. The escaping (replace / with %2F) did not solve the issue, instead, I got a connection problem.

Is this a possible issue with Krato’s approach to parsing the configuration? I tried a combination of credentials:

- smtp://alphanumeric:[email protected]:25 [OK]
- smtp://[email protected]:[email protected]@server:25 [OK]
- smtp://alphanumericwith/:alphanumericwith/@server:25 [FAILED]
- smtp://alphanumericwith%2F:alphanumericwith%[email protected]:25 [FAILED]

The tests were also being done, using another popular email service with SMTP support.

The only way to make sure is from the Kratos test to test these cases. I wish I have time to spare to investigate this directly from the Kratos code base. Or any idea/trick as a workaround?

My next question is, what is the technical reason for using this format for SMTP configuration?

courier:
  smtp:
    connection_uri: smtp://test:[email protected]:2525/?skip_ssl_verify=true

Can we have something like this?

 courier:
      smtp:
        username: ...
        password: ...
        port: ...
        host: ...
        ssl: false/true

So after investigation:

No issue with parsing credentials with a forward slash. You can escape it and replace / with %2F.

To the Ory team, I’m sorry for the inconvenience.

But this kind of configuration:

courier:
      smtp:
        username: ...
        password: ...
        port: ...
        host: ...
        ssl: false/true

Seems more readable for me. Just a small feedback.

1 Like

Thank you for the ideas and suggestions and the solution! I think this is very helpful for many :slight_smile: Maybe you’d like to contribute your finding to: https://www.ory.sh/kratos/docs/concepts/email-sms - that would be awesome!

Sure, I will be happy to contribute.