當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。