当前位置: 首页>>代码示例>>Java>>正文


Java Email.setTLS方法代码示例

本文整理汇总了Java中org.apache.commons.mail.Email.setTLS方法的典型用法代码示例。如果您正苦于以下问题:Java Email.setTLS方法的具体用法?Java Email.setTLS怎么用?Java Email.setTLS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.mail.Email的用法示例。


在下文中一共展示了Email.setTLS方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupEmail

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
private void setupEmail(Email email) throws EmailException {
	email.setHostName(getHostName());
	email.setSslSmtpPort(getSmtpPort());
	email.setFrom(getReplyAddress(), getReplyName());

	if (StringUtils.isNotBlank(useSsl)) {
		email.setSSL(Boolean.valueOf(getUseSsl()));
		email.setSslSmtpPort(getSslPort());
	}

	if (StringUtils.isNotBlank(useTls)) {
		email.setTLS(Boolean.valueOf(getUseTls()));
	}

	// use authentication if configured
	if (StringUtils.isNotBlank(getAuthenticationUserName())) {
		email.setAuthenticator(new DefaultAuthenticator(getAuthenticationUserName(), getAuthenticationPassword()));
	}
}
 
开发者ID:SmarterApp,项目名称:TechnologyReadinessTool,代码行数:20,代码来源:EmailServiceImpl.java

示例2: setMailServerProperties

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
protected void setMailServerProperties(Email email) {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

  String host = processEngineConfiguration.getMailServerHost();
  if (host == null) {
    throw new ActivitiException("Could not send email: no SMTP host is configured");
  }
  email.setHostName(host);

  int port = processEngineConfiguration.getMailServerPort();
  email.setSmtpPort(port);

  email.setTLS(processEngineConfiguration.getMailServerUseTLS());

  String user = processEngineConfiguration.getMailServerUsername();
  String password = processEngineConfiguration.getMailServerPassword();
  if (user != null && password != null) {
    email.setAuthentication(user, password);
  }
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:21,代码来源:MailActivityBehavior.java

示例3: send

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
@Override
public void send(String recipient, String subject, String content) throws SendMailException {
	Assert.hasText(recipient);
	Assert.hasText(subject);
	Assert.hasText(content);
	
	Email email = new SimpleEmail();
	email.setHostName(host);
	email.setAuthenticator(new DefaultAuthenticator(loginName, loginPassword));
	email.setSmtpPort(port);
	email.setTLS(tls);

	try {
		email.setCharset("UTF-8"); // specify the charset.
		email.setFrom(fromAddress, fromName);
		email.setSubject(subject);
		email.setMsg(content);
		email.addTo(recipient);
		email.send();
	} catch (EmailException e) {
		throw new SendMailException(
				String.format("Failed to send mail to %s.", recipient), e);

	}
}
 
开发者ID:ivarptr,项目名称:clobaframe,代码行数:26,代码来源:SmtpMailSender.java

示例4: post

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
@Override
public String post(Email message) {
	
	try {
		message.setSmtpPort(587);
	    message.setAuthenticator(new DefaultAuthenticator("[email protected]", "3cWaN2jGhEbAAT"));
	    message.setDebug(false);
	    message.setHostName("smtp.gmail.com");
	    message.setFrom("The Job Announcer <[email protected]>");
	    message.setTLS(true);
	    message.send();
		log.info("Mailed Notification with subject '" + message.getSubject() + "'.");
		return message.toString();
	} catch (EmailException e) {
	    log.warning("Failed to mail Notification with subject '" + message.getSubject() + "'.");
		log.throwing(getClass().getName(), "post", e);
		throw new RuntimeException(e);
	}
	
}
 
开发者ID:plexiti,项目名称:the-job-announcement,代码行数:21,代码来源:MailingServiceImpl.java

示例5: setMailServerProperties

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
protected void setMailServerProperties(Email email) {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

  String host = processEngineConfiguration.getMailServerHost();
  if (host == null) {
    throw new ActivitiException("Could not send email: no SMTP host is configured");
  }
  email.setHostName(host);

  int port = processEngineConfiguration.getMailServerPort();
  email.setSmtpPort(port);

  email.setSSL(processEngineConfiguration.getMailServerUseSSL());
  email.setTLS(processEngineConfiguration.getMailServerUseTLS());

  String user = processEngineConfiguration.getMailServerUsername();
  String password = processEngineConfiguration.getMailServerPassword();
  if (user != null && password != null) {
    email.setAuthentication(user, password);
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:22,代码来源:MailActivityBehavior.java

示例6: setMailServerProperties

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
protected void setMailServerProperties(Email email) {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

  String host = processEngineConfiguration.getMailServerHost();
  ensureNotNull("Could not send email: no SMTP host is configured", "host", host);
  email.setHostName(host);

  int port = processEngineConfiguration.getMailServerPort();
  email.setSmtpPort(port);

  email.setTLS(processEngineConfiguration.getMailServerUseTLS());

  String user = processEngineConfiguration.getMailServerUsername();
  String password = processEngineConfiguration.getMailServerPassword();
  if (user != null && password != null) {
    email.setAuthentication(user, password);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:MailActivityBehavior.java


注:本文中的org.apache.commons.mail.Email.setTLS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。