1 10 11 package org.mule.providers.email; 12 13 import org.mule.umo.lifecycle.InitialisationException; 14 15 18 public class SmtpsConnector extends SmtpConnector 19 { 20 21 public static final String DEFAULT_SOCKET_FACTORY = "javax.net.ssl.SSLSocketFactory"; 22 23 private String socketFactory = DEFAULT_SOCKET_FACTORY; 24 private String socketFactoryFallback = "false"; 25 private String trustStore = null; 26 private String trustStorePassword = null; 27 28 public static final int DEFAULT_SMTPS_PORT = 465; 29 30 public SmtpsConnector() throws InitialisationException 31 { 32 super(); 33 } 34 35 40 public String getProtocol() 41 { 42 return "smtps"; 43 } 44 45 public int getDefaultPort() 46 { 47 return DEFAULT_SMTPS_PORT; 48 } 49 50 public void doInitialise() throws InitialisationException 51 { 52 super.doInitialise(); 53 System.setProperty("mail.smtps.ssl", "true"); 54 System.setProperty("mail.smtps.socketFactory.class", getSocketFactory()); 55 System.setProperty("mail.smtps.socketFactory.fallback", getSocketFactoryFallback()); 56 57 67 68 if (getTrustStore() != null) 69 { 70 System.setProperty("javax.net.ssl.trustStore", getTrustStore()); 71 if (getTrustStorePassword() != null) 72 { 73 System.setProperty("javax.net.ssl.trustStorePassword", getTrustStorePassword()); 74 } 75 } 76 } 77 78 public String getSocketFactory() 79 { 80 return socketFactory; 81 } 82 83 public void setSocketFactory(String sslSocketFactory) 84 { 85 this.socketFactory = sslSocketFactory; 86 } 87 88 public String getSocketFactoryFallback() 89 { 90 return socketFactoryFallback; 91 } 92 93 public void setSocketFactoryFallback(String socketFactoryFallback) 94 { 95 this.socketFactoryFallback = socketFactoryFallback; 96 } 97 98 public String getTrustStore() 99 { 100 return trustStore; 101 } 102 103 public void setTrustStore(String trustStore) 104 { 105 this.trustStore = trustStore; 106 } 107 108 public String getTrustStorePassword() 109 { 110 return trustStorePassword; 111 } 112 113 public void setTrustStorePassword(String trustStorePassword) 114 { 115 this.trustStorePassword = trustStorePassword; 116 } 117 } 118 | Popular Tags |