本文整理了Java中com.sun.mail.util.MailSSLSocketFactory.setTrustAllHosts()方法的一些代码示例,展示了
本文整理了Java中com.sun.mail.util.MailSSLSocketFactory.setTrustAllHosts()
方法的一些代码示例,展示了MailSSLSocketFactory.setTrustAllHosts()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MailSSLSocketFactory.setTrustAllHosts()
方法的具体详情如下:
包路径:com.sun.mail.util.MailSSLSocketFactory
类名称:MailSSLSocketFactory
方法名:setTrustAllHosts
MailSSLSocketFactory.setTrustAllHosts介绍
暂无
代码示例
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
props.put("mail.smtp.ssl.socketFactory", sf);
代码示例来源:origin: SeanDragon/protools
/**
* @param mailDebug
* 开启debug调试,以便在控制台查看
* @param mailHost
* 设置邮件服务器主机名
* @param mailTransportProtocol
* 发送邮件协议名称
* @param mailAuth
* 发送服务器需要身份验证
* @param mailSsl
* 开启SSL加密,否则会失败
*/
private void init(Boolean mailDebug, String mailHost, String mailTransportProtocol, Boolean mailAuth, Boolean mailSsl) throws Exception {
prop = new Properties();
prop.setProperty("mail.debug", mailDebug.toString());
prop.setProperty("mail.host", mailHost);
prop.setProperty("mail.smtp.auth", mailAuth.toString());
prop.setProperty("mail.transport.protocol", mailTransportProtocol);
prop.put("mail.smtp.ssl.enable", mailSsl);
if (mailSsl) {
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
prop.put("mail.smtp.ssl.socketFactory", sf);
}
// 创建session
session = Session.getInstance(prop);
}
代码示例来源:origin: camunda/camunda-bpm-platform
MailSSLSocketFactory msf = new MailSSLSocketFactory();
if (trusted.equals("*"))
msf.setTrustAllHosts(true);
else
msf.setTrustedHosts(trusted.split("\\s+"));
代码示例来源:origin: com.sun.mail/javax.mail
MailSSLSocketFactory msf = new MailSSLSocketFactory();
if (trusted.equals("*"))
msf.setTrustAllHosts(true);
else
msf.setTrustedHosts(trusted.split("\\s+"));
代码示例来源:origin: camunda/camunda-bpm-platform
MailSSLSocketFactory msf = new MailSSLSocketFactory();
if (trusted.equals("*"))
msf.setTrustAllHosts(true);
else
msf.setTrustedHosts(trusted.split("\\s+"));
代码示例来源:origin: com.sun.mail/javax.mail
MailSSLSocketFactory msf = new MailSSLSocketFactory();
if (trusted.equals("*"))
msf.setTrustAllHosts(true);
else
msf.setTrustedHosts(trusted.split("\\s+"));
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
// or
// sf.setTrustedHosts(new String[] { "my-server" });
props.put("mail.smtp.ssl.enable", "true");
// also use following for additional safety
//props.put("mail.smtp.ssl.checkserveridentity", "true");
props.put("mail.smtp.ssl.socketFactory", sf);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
props.put("mail.imap.starttls.enable", "true");
props.put("mail.imap.ssl.socketFactory", sf);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
// or
// sf.setTrustedHosts(new String[] { "my-server" });
props.put("mail.smtp.ssl.enable", "true");
// also use following for additional safety
//props.put("mail.smtp.ssl.checkserveridentity", "true");
props.put("mail.smtp.ssl.socketFactory", sf);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
props.put("mail.smtp.ssl.trust", "*");
props.put("mail.smtp.ssl.socketFactory", sf);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
properties.put("mail.imap.ssl.trust", "*");
properties.put("mail.imap.ssl.socketFactory", sf);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory socketFactory= new MailSSLSocketFactory();
socketFactory.setTrustAllHosts(true);
prop.put("mail.pop3s.ssl.socketFactory", socketFactory);
代码示例来源:origin: stackoverflow.com
Properties props = new Properties();
MailSSLSocketFactory socketFactory = new MailSSLSocketFactory();
socketFactory.setTrustAllHosts(true);
props.put("mail.imaps.ssl.socketFactory", socketFactory);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory socketFactory= new MailSSLSocketFactory();
socketFactory.setTrustAllHosts(true);
prop.put("mail.imap.ssl.socketFactory", socketFactory);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
props.put("mail.smtp.ssl.socketFactory", sf);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory socketFactory = new MailSSLSocketFactory();
socketFactory.setTrustAllHosts(true);
代码示例来源:origin: stackoverflow.com
MailSSLSocketFactory socketFactory = new MailSSLSocketFactory();
socketFactory.setTrustAllHosts(true);
代码示例来源:origin: forezp/BootNettyRpc
@Override
protected Properties createProperties() {
Properties properties = super.createProperties();
properties.put("mail.smtp.port", "465");
properties.put("mail.smtp.socketFactory.port", "465");
properties.put("mail.smtp.ssl.enable", "true");
properties.put("mail.smtp.starttls.enable", "true");
MailSSLSocketFactory sslSocketFactory = null;
try {
sslSocketFactory = new MailSSLSocketFactory();
} catch (Exception e) {
e.printStackTrace();
}
sslSocketFactory.setTrustAllHosts(true);
properties.put("mail.smtp.ssl.socketFactory", sslSocketFactory);
return properties;
}
}
代码示例来源:origin: stackoverflow.com
sysProperties.put("mail.imap.starttls.enable", true);
MailSSLSocketFactory sf = null;
try {
sf = new MailSSLSocketFactory();
} catch (GeneralSecurityException e1) {
e1.printStackTrace();
}
sf.setTrustAllHosts(true);
sysProperties.setProperty("mail.imaps.auth.plain.disable", "true");
sysProperties.setProperty("mail.imaps.auth.ntlm.disable", "true");
sysProperties.put("mail.imap.ssl.socketFactory", sf);
sysProperties.setProperty("mail.imap.port", instance.getConfigPropertiesValue(configProperties, "mail.imap.port"));
sysProperties.setProperty("mail.imap.ssl.socketFactory.port", "993");
Session session = Session.getDefaultInstance(sysProperties, null);
Store store = null;
store = session.getStore("imaps");
store.connect("mail.serverhost", "mail.serverport"), "mail.username,"mail.password"));
代码示例来源:origin: com.mgmtp.jfunk/jfunk-core
@Provides
@StoreSession
Properties provideStoreSession(final Configuration config) throws GeneralSecurityException {
String protocol = checkNotNull(config.get(MAIL_STORE_PROTOCOL), "Property %s not configured.", MAIL_STORE_PROTOCOL);
Properties sessiOnProps= new Properties();
sessionProps.putAll(filterKeys(config, contains('.' + protocol + '.')));
sessionProps.setProperty(MAIL_DEBUG, config.get(MAIL_DEBUG, "false"));
sessionProps.setProperty(MAIL_STORE_PROTOCOL, protocol);
if (config.getBoolean(MAIL_SSL_TRUST)) {
MailSSLSocketFactory socketFactory = new MailSSLSocketFactory();
socketFactory.setTrustAllHosts(true);
sessionProps.put("mail." + protocol + ".ssl.socketFactory", socketFactory);
}
return sessionProps;
}