7
7
import org .simplejavamail .api .mailer .config .ProxyConfig ;
8
8
import org .simplejavamail .config .ConfigLoader .Property ;
9
9
import org .simplejavamail .internal .modules .ModuleLoader ;
10
+ import org .simplejavamail .internal .util .SimpleOptional ;
10
11
11
12
import javax .annotation .Nonnull ;
12
13
import javax .annotation .Nullable ;
29
30
import static org .simplejavamail .config .ConfigLoader .valueOrProperty ;
30
31
import static org .simplejavamail .config .ConfigLoader .valueOrPropertyAsBoolean ;
31
32
import static org .simplejavamail .config .ConfigLoader .valueOrPropertyAsInteger ;
33
+ import static org .simplejavamail .config .ConfigLoader .valueOrPropertyAsString ;
32
34
import static org .simplejavamail .internal .util .MiscUtil .checkArgumentNotEmpty ;
33
35
import static org .simplejavamail .internal .util .MiscUtil .valueNullOrEmpty ;
34
36
import static org .simplejavamail .internal .util .Preconditions .assumeNonNull ;
@@ -191,6 +193,8 @@ abstract class MailerGenericBuilderImpl<T extends MailerGenericBuilderImpl<?>> i
191
193
this .proxyBridgePort = assumeNonNull (valueOrPropertyAsInteger (null , Property .PROXY_SOCKS5BRIDGE_PORT , DEFAULT_PROXY_BRIDGE_PORT ));
192
194
this .debugLogging = assumeNonNull (valueOrPropertyAsBoolean (null , Property .JAVAXMAIL_DEBUG , DEFAULT_JAVAXMAIL_DEBUG ));
193
195
this .sessionTimeout = assumeNonNull (valueOrPropertyAsInteger (null , Property .DEFAULT_SESSION_TIMEOUT_MILLIS , DEFAULT_SESSION_TIMEOUT_MILLIS ));
196
+ this .trustAllSSLHost = assumeNonNull (valueOrPropertyAsBoolean (null , Property .DEFAULT_TRUST_ALL_HOSTS , DEFAULT_TRUST_ALL_HOSTS ));
197
+ this .verifyingServerIdentity = assumeNonNull (valueOrPropertyAsBoolean (null , Property .DEFAULT_VERIFY_SERVER_IDENTITY , DEFAULT_VERIFY_SERVER_IDENTITY ));
194
198
this .threadPoolSize = assumeNonNull (valueOrPropertyAsInteger (null , Property .DEFAULT_POOL_SIZE , DEFAULT_POOL_SIZE ));
195
199
this .threadPoolKeepAliveTime = assumeNonNull (valueOrPropertyAsInteger (null , Property .DEFAULT_POOL_KEEP_ALIVE_TIME , DEFAULT_POOL_KEEP_ALIVE_TIME ));
196
200
this .connectionPoolCoreSize = assumeNonNull (valueOrPropertyAsInteger (null , Property .DEFAULT_CONNECTIONPOOL_CORE_SIZE , DEFAULT_CONNECTIONPOOL_CORE_SIZE ));
@@ -200,9 +204,12 @@ abstract class MailerGenericBuilderImpl<T extends MailerGenericBuilderImpl<?>> i
200
204
this .connectionPoolLoadBalancingStrategy = assumeNonNull (valueOrProperty (null , Property .DEFAULT_CONNECTIONPOOL_LOADBALANCING_STRATEGY , LoadBalancingStrategy .valueOf (DEFAULT_CONNECTIONPOOL_LOADBALANCING_STRATEGY )));
201
205
this .transportModeLoggingOnly = assumeNonNull (valueOrPropertyAsBoolean (null , Property .TRANSPORT_MODE_LOGGING_ONLY , DEFAULT_TRANSPORT_MODE_LOGGING_ONLY ));
202
206
207
+ final String trustedHosts = valueOrPropertyAsString (null , Property .DEFAULT_TRUSTED_HOSTS , null );
208
+ if (trustedHosts != null ) {
209
+ this .sslHostsToTrust = Arrays .asList (trustedHosts .split (";" ));
210
+ }
211
+
203
212
this .emailAddressCriteria = EmailAddressCriteria .RFC_COMPLIANT .clone ();
204
- this .trustAllSSLHost = true ;
205
- this .verifyingServerIdentity = true ;
206
213
207
214
this .executorService = determineDefaultExecutorService ();
208
215
}
@@ -507,14 +514,30 @@ public T withProperty(@Nonnull final String propertyName, @Nullable final Object
507
514
}
508
515
return (T ) this ;
509
516
}
510
-
517
+
511
518
/**
512
519
* @see MailerGenericBuilder#resetSessionTimeout()
513
520
*/
514
521
@ Override
515
522
public T resetSessionTimeout () {
516
523
return withSessionTimeout (DEFAULT_SESSION_TIMEOUT_MILLIS );
517
524
}
525
+
526
+ /**
527
+ * @see MailerGenericBuilder#resetTrustingAllHosts()
528
+ */
529
+ @ Override
530
+ public T resetTrustingAllHosts () {
531
+ return trustingAllHosts (DEFAULT_TRUST_ALL_HOSTS );
532
+ }
533
+
534
+ /**
535
+ * @see MailerGenericBuilder#resetVerifyingServerIdentity()
536
+ */
537
+ @ Override
538
+ public T resetVerifyingServerIdentity () {
539
+ return verifyingServerIdentity (DEFAULT_VERIFY_SERVER_IDENTITY );
540
+ }
518
541
519
542
/**
520
543
* @see MailerGenericBuilder#resetEmailAddressCriteria()
0 commit comments