本文整理匯總了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;
}