diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8d3a1e4..fb902d3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - otp: ["24"] # https://www.erlang.org/downloads + otp: ["25"] # https://www.erlang.org/downloads rebar3: ["3.18.0"] # https://www.rebar3.org steps: diff --git a/src/gen_smtp_client.erl b/src/gen_smtp_client.erl index 0e585cc..0221580 100644 --- a/src/gen_smtp_client.erl +++ b/src/gen_smtp_client.erl @@ -898,7 +898,10 @@ read_possible_multiline_reply(Socket) -> Code = binstr:substr(Packet, 1, 3), read_multiline_reply(Socket, Code, [Packet]); <<" ">> -> - {ok, Packet} + {ok, Packet}; + _ -> + quit(Socket), + throw({unexpected_response, Packet}) end; Error -> throw({network_failure, Error}) diff --git a/src/gen_smtp_server_session.erl b/src/gen_smtp_server_session.erl index 1090876..b0e44c8 100644 --- a/src/gen_smtp_server_session.erl +++ b/src/gen_smtp_server_session.erl @@ -829,7 +829,7 @@ handle_request({<<"NOOP">>, _Any}, State) -> send(State, "250 Ok\r\n"), {ok, State}; handle_request({<<"QUIT">>, _Any}, State) -> - send(State, "221 Bye\r\n"), + try_send(State, "221 Bye\r\n"), {stop, normal, State}; handle_request( {<<"VRFY">>, Address}, @@ -1358,6 +1358,14 @@ check_bare_crlf(Binary, _Prev, Op, Offset) -> end end. +try_send(#state{transport = Transport, socket = Sock} = St, Data) -> + case Transport:send(Sock, Data) of + ok -> + ok; + {error, _Err} -> + ok + end. + send(#state{transport = Transport, socket = Sock} = St, Data) -> case Transport:send(Sock, Data) of ok ->