@@ -255,11 +255,17 @@ public final void sendMail(final Email email)
255
255
* Simply logs host details, credentials used and whether authentication will take place and finally the transport protocol used.
256
256
*/
257
257
private void logSession (Session session , TransportStrategy transportStrategy ) {
258
- final String logmsg = "starting mail session (host: %s, port: %s, username: %s, authenticate: %s, transport: %s)" ;
259
258
Properties properties = session .getProperties ();
260
- logger .debug (String .format (logmsg , properties .get (transportStrategy .propertyNameHost ()),
261
- properties .get (transportStrategy .propertyNamePort ()), properties .get (transportStrategy .propertyNameUsername ()),
262
- properties .get (transportStrategy .propertyNameAuthenticate ()), transportStrategy ));
259
+ final String specifics ;
260
+ if (transportStrategy != null ) {
261
+ final String logmsg = "starting mail session (host: %s, port: %s, username: %s, authenticate: %s, transport: %s)" ;
262
+ specifics = String .format (logmsg , properties .get (transportStrategy .propertyNameHost ()),
263
+ properties .get (transportStrategy .propertyNamePort ()), properties .get (transportStrategy .propertyNameUsername ()),
264
+ properties .get (transportStrategy .propertyNameAuthenticate ()), transportStrategy );
265
+ } else {
266
+ specifics = properties .toString ();
267
+ }
268
+ logger .debug (String .format ("starting mail session (%s)" , specifics ));
263
269
}
264
270
265
271
/**
0 commit comments