E-mail TLS, unable to send

79 views
Skip to first unread message

llfbandit

unread,
Aug 26, 2016, 9:44:01 AM8/26/16
to vert.x
Hello,

I have difficulties to send an email with TLS

Here's my pseudo config:

MailConfig mailConfig = new MailConfig()
                .setHostname("smtp.y.z")
                .setPort(587)
                .setStarttls(StartTLSOptions.REQUIRED)
                .setLogin(LoginOption.REQUIRED)
                .setUsername("***")
                .setPassword("***")
                .setTrustAll(true);

I tried with gmail & office 365, the result is always the same the server close the connection.
On both, I'm able to send emails via my desktop email client.

llfbandit

unread,
Aug 26, 2016, 11:07:54 AM8/26/16
to vert.x
Another test made with mailjet is successful with the "same" config.

Any clue about those two providers?

Alexander Lehmann

unread,
Aug 26, 2016, 1:51:26 PM8/26/16
to vert.x
Can you run your program with the log config set the DEBUG? (either with log4j or slf4j)

If a login failure happens, the mail client should get a failed AsyncResult with an exception, maybe that contains an error message.

I am using the smtp client with gmail successfull, however this requires setting the google account to support less secure client (essentially auth plain) since oauth is not yet supported.

Not sure about office 365, have to check if I can test that.

llfbandit

unread,
Aug 29, 2016, 4:52:57 AM8/29/16
to vert.x
Ok, everything is on me...

For google, it was an encoding problem. The sources were not encoded in UTF-8.
And for both, as I was doing this in a JUnit test not dedicated to this so I was closing Vertx and its dependencies before the email was really sent.

To conclude, never make quick & dirty tests...

Thanks for the reply Alexander.
Reply all
Reply to author
Forward
0 new messages