本文整理汇总了Java中org.springframework.mail.javamail.JavaMailSenderImpl.getJavaMailProperties方法的典型用法代码示例。如果您正苦于以下问题:Java JavaMailSenderImpl.getJavaMailProperties方法的具体用法?Java JavaMailSenderImpl.getJavaMailProperties怎么用?Java JavaMailSenderImpl.getJavaMailProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.mail.javamail.JavaMailSenderImpl
的用法示例。
在下文中一共展示了JavaMailSenderImpl.getJavaMailProperties方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.springframework.mail.javamail.JavaMailSenderImpl; //导入方法依赖的package包/类
private static JavaMailSender build(MailConfigSource config) {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setDefaultEncoding(StandardCharsets.UTF_8.name());
mailSender.setHost(config.mailServer().getHost());
mailSender.setPort(config.mailServer().getPort());
JProps mailProps = new JProps(mailSender.getJavaMailProperties());
configureTransport(config, mailProps);
config.username().ifPresent(
u -> configureAuthentication(config, u, mailSender, mailProps));
if (MailProtocol.smtps.equals(config.protocol())) {
configureTls(config, mailProps);
}
return mailSender;
}
示例2: getConfig
import org.springframework.mail.javamail.JavaMailSenderImpl; //导入方法依赖的package包/类
@Bean
public JavaMailSender getConfig() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost(emailHost);
mailSender.setPort(emailPort);
mailSender.setUsername(emailUser);
mailSender.setPassword(emailPassword);
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.debug", "true");
return mailSender;
}
示例3: getValidFakeConfig
import org.springframework.mail.javamail.JavaMailSenderImpl; //导入方法依赖的package包/类
private JavaMailSender getValidFakeConfig() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("localhost");
mailSender.setPort(SimpleSmtpServer.DEFAULT_SMTP_PORT);
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.debug", "true");
return mailSender;
}
示例4: getWrongFakeConfig
import org.springframework.mail.javamail.JavaMailSenderImpl; //导入方法依赖的package包/类
private JavaMailSender getWrongFakeConfig() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("google.bla");
mailSender.setPort(12345);
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.debug", "true");
return mailSender;
}
示例5: getEmailSender
import org.springframework.mail.javamail.JavaMailSenderImpl; //导入方法依赖的package包/类
private static JavaMailSender getEmailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("localhost");
mailSender.setPort(5025);
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "false");
props.put("mail.smtp.starttls.enable", "false");
props.put("mail.debug", "false");
return mailSender;
}
示例6: getJavaMailSender
import org.springframework.mail.javamail.JavaMailSenderImpl; //导入方法依赖的package包/类
private JavaMailSender getJavaMailSender(String email, char[] password) {
Map<String, String> smtpMap = EmailUtil.parseEmailHost(email);
if (smtpMap.size() != 0) {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost(smtpMap.get("sendService"));
int port = NumberUtils.toInt(smtpMap.get("sendServicePort"));
mailSender.setPort(port);
mailSender.setUsername(email);
mailSender.setPassword(new String(password));
// https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", smtpMap.get("sendprotocol"));
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.connectiontimeout", configProperties.getMailConnectiontimeout().toString());
props.put("mail.smtp.timeout", configProperties.getMailTimeout().toString());
props.put("mail.smtp.writetimeout", configProperties.getMailWritetimeout().toString());
if (smtpMap.get("sendServiceEncrypt") != null) {
String key = "mail.smtp." + smtpMap.get("sendServiceEncrypt") + ".enable";
props.put(key, "true");
}
if (LOG.isDebugEnabled()) {
props.put("mail.debug", "true");
}
return mailSender;
} else {
return null;
}
}
示例7: javaMailSender
import org.springframework.mail.javamail.JavaMailSenderImpl; //导入方法依赖的package包/类
@Bean
public JavaMailSender javaMailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost(properties.getProperty("email.host"));
mailSender.setPort(Integer.valueOf(properties.getProperty("email.port")));
mailSender.setUsername(properties.getProperty("email.username"));
mailSender.setPassword(properties.getProperty("email.password"));
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
return mailSender;
}