gen-smtp / gen_smtp

The extensible Erlang SMTP client and server library.
Other
684 stars 267 forks source link

auth_failed is not working when gen_smtp_client:open/1 #339

Open IciaCarroBarallobre opened 2 months ago

IciaCarroBarallobre commented 2 months ago

https://github.com/gen-smtp/gen_smtp/blob/21c3e247a68ba524575eeed39539e654f499bfdf/src/gen_smtp_client.erl#L219

When gen_smtp_client:open/1 to check if the authorization credentials are correct:

Code:

        {ok, SocketDescriptor} = gen_smtp_client:open([{relay, ...},
                            {ssl, true},
                            {sockopts, [{depth, 20},
                                        {verify, verify_peer},
                                        {server_name_indication, SNI},
                                        {cacerts, certifi:cacerts()}]},
                            {username, ...},
                            {password, ...}]),
        gen_smtp_client:close(SocketDescriptor).

Exception trace:

{{case_clause,<<"y">>},
 [{gen_smtp_client, read_possible_multiline_reply, 1, [{file, "_build/default/lib/gen_smtp/src/gen_smtp_client.erl"}, {line,841}]},
 {gen_smtp_client, do_AUTH_each,5, [{file,"_build/default/lib/gen_smtp/src/gen_smtp_client.erl"},{line,623}]},
 {gen_smtp_client, try_AUTH,3, [{file,"_build/default/lib/gen_smtp/src/gen_smtp_client.erl"}, {line,556}]},
 {gen_smtp_client, open_smtp_session,2, [{file, "/_build/default/lib/gen_smtp/src/gen_smtp_client.erl"}, {line,384}]},
 {gen_smtp_client, try_smtp_sessions,3, [{file, "_build/default/lib/gen_smtp/src/gen_smtp_client.erl"}, {line,316}]},
 ...
mworrell commented 1 month ago

Can you check what the server is sending back?