当前位置: 首页>>代码示例>>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;未经允许,请勿转载。