papercups-io / papercups

Open-source live customer chat
https://app.papercups.io/demo
MIT License
5.76k stars 523 forks source link

SMTP adapter is broken in Docker image #1009

Open taobojlen opened 2 years ago

taobojlen commented 2 years ago

Describe the bug When self-hosting Papercups with docker compose, the SMTP mailer is broken.

To Reproduce Steps to reproduce the behavior:

  1. Open iex
  2. import Swoosh.Email
  3. Try to send an email like new() |> from("noreply@support.example.com") |> to("myself@example.com") |> subject("Hi there") |> text_body("Testing SMTP integration") |> ChatApi.Mailers.deliver(). You will see the following error:
** (ArgumentError) argument error
    :erlang.split_binary('250-smtp.ohmysmtp.com Nice to meet you, static.106.78.235.167.clients.your-server.de\r\n', 3)
    (gen_smtp 0.15.0) /app/deps/gen_smtp/src/binstr.erl:114: :binstr.substr/3
    (gen_smtp 0.15.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:697: :gen_smtp_client.read_possible_multiline_reply/1
    (gen_smtp 0.15.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:562: :gen_smtp_client.try_EHLO/2
    (gen_smtp 0.15.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:623: :gen_smtp_client.do_STARTTLS/2
    (gen_smtp 0.15.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:594: :gen_smtp_client.try_STARTTLS/3
    (gen_smtp 0.15.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:333: :gen_smtp_client.open_smtp_session/2
    (gen_smtp 0.15.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:271: :gen_smtp_client.try_smtp_sessions/3

Expected behavior Sending the email works.

Additional context I believe this is caused by this bug: https://github.com/gen-smtp/gen_smtp/issues/250

If that's the case, using a more recent version of Elixir/OTP in the Docker image would fix it, as would updating gen_smtp.