當前位置: 首頁>>代碼示例>>Java>>正文


Java JavaMailSenderImpl.getJavaMailProperties方法代碼示例

本文整理匯總了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;
}
 
開發者ID:openmicroscopy,項目名稱:omero-ms-queue,代碼行數:18,代碼來源:MailClientAdapter.java

示例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;
}
 
開發者ID:daflockinger,項目名稱:poppynotes,代碼行數:16,代碼來源:GeneralConfig.java

示例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;
}
 
開發者ID:daflockinger,項目名稱:poppynotes,代碼行數:13,代碼來源:EmailServiceTest.java

示例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;
}
 
開發者ID:daflockinger,項目名稱:poppynotes,代碼行數:13,代碼來源:EmailServiceTest.java

示例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;
}
 
開發者ID:gessnerfl,項目名稱:fake-smtp-server,代碼行數:14,代碼來源:TestDataCreator.java

示例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;
	}
}
 
開發者ID:Saisimon,項目名稱:tip,代碼行數:29,代碼來源:EmailHelper.java

示例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;
}
 
開發者ID:pablogrela,項目名稱:members_cuacfm,代碼行數:16,代碼來源:ApplicationConfig.java


注:本文中的org.springframework.mail.javamail.JavaMailSenderImpl.getJavaMailProperties方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。