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


Java ServerConfig类代码示例

本文整理汇总了Java中org.simplejavamail.mailer.config.ServerConfig的典型用法代码示例。如果您正苦于以下问题:Java ServerConfig类的具体用法?Java ServerConfig怎么用?Java ServerConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initMailer

import org.simplejavamail.mailer.config.ServerConfig; //导入依赖的package包/类
private void initMailer() {

        String host = appConfig.get(CONFIG_KEY_SMTP_HOST, "");
        int port = appConfig.getInt(CONFIG_KEY_SMTP_PORT, 465);
        String secure = appConfig.get(CONFIG_KEY_SMTP_SECURE, "tls");
        String username = appConfig.get(CONFIG_KEY_SMTP_USERNAME, "");
        String password = appConfig.get(CONFIG_KEY_SMTP_PASS, "");

        TransportStrategy transportStrategy = TransportStrategy.SMTP_PLAIN;
        if (secure.toLowerCase().equals("tls")) {

            transportStrategy = TransportStrategy.SMTP_TLS;
        } else if (secure.toLowerCase().equals("ssl")) {

            transportStrategy = TransportStrategy.SMTP_SSL;
        }

        mailer = new Mailer(new ServerConfig(host, port, username, password), transportStrategy);
        mailer.setSessionTimeout(30000);
//        mailer.setDebug(appConfig.getBool(CONFIG_KEY_APP_DEV_MODE, false));
    }
 
开发者ID:thundernet8,项目名称:Elune,代码行数:22,代码来源:MailMQServiceImpl.java

示例2: writeReport

import org.simplejavamail.mailer.config.ServerConfig; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * <p>
 * Render the report HTML using Jtwig and send the result to the recipient emails.
 */
@Override
public void writeReport(List<TestSuite> testSuites) throws IOException {
    if (testSuites == null) {
        testSuites = Collections.emptyList();
    }
    log.info("Sending report email for {} test suites", testSuites.size());
    List<TestSuiteModel> testList = new ArrayList<>(testSuites.size());
    boolean hasError = false;
    for (TestSuite testSuite : testSuites) {
        TestSuiteModel testSuiteModel = new TestSuiteModel(testSuite);
        hasError = hasError || !testSuiteModel.allPassed();
        testList.add(testSuiteModel);
    }
    JtwigTemplate template = JtwigTemplate.classpathTemplate("templates/email.twig");
    JtwigModel model = JtwigModel.newModel()
                                 .with("error", hasError)
                                 .with("testList", testList);
    String reportHtml = template.render(model);
    EmailBuilder emailBuilder = new EmailBuilder().from(senderName, fromEmail)
                                                  .replyTo(senderName, replyTo)
                                                  .subject("Validatar Report – " + (hasError ? "Test Errors" : "Tests Passed"))
                                                  .addHeader("X-Priority", 2)
                                                  .textHTML(reportHtml);
    for (String recipientEmail : recipientEmails) {
        emailBuilder.to(recipientEmail);
    }
    Email reportEmail = emailBuilder.build();
    ServerConfig mailServerConfig = new ServerConfig(smtpHost, smtpPort);
    Mailer reportMailer = new Mailer(mailServerConfig, TransportStrategy.SMTP_TLS);
    sendEmail(reportMailer, reportEmail);
    log.info("Finished sending report to recipients");
}
 
开发者ID:yahoo,项目名称:validatar,代码行数:38,代码来源:EmailFormatter.java

示例3: start

import org.simplejavamail.mailer.config.ServerConfig; //导入依赖的package包/类
public void start() {
  mailer = new Mailer(
      new ServerConfig(
          Configuration.i.getSmtp().getHost(),
          Configuration.i.getSmtp().getPort(),
          Configuration.i.getSmtp().getUserName(),
          Configuration.i.getSmtp().getPassword()),
      TransportStrategy.SMTP_TLS);

  Properties props = new Properties();
  props.put("mail.smtp.localhost", "codeka.com.au");
  mailer.applyProperties(props);
}
 
开发者ID:codeka,项目名称:wwmmo,代码行数:14,代码来源:SmtpHelper.java

示例4: sendMail

import org.simplejavamail.mailer.config.ServerConfig; //导入依赖的package包/类
@Override
public void sendMail() {
	new Mailer( new ServerConfig("smtp.host.com", 587),
                   TransportStrategy.SMTP_TLS
                   ).sendMail(email);
}
 
开发者ID:maugern,项目名称:jersey-skeleton,代码行数:7,代码来源:ConfirmationMail.java

示例5: sendMail

import org.simplejavamail.mailer.config.ServerConfig; //导入依赖的package包/类
@Override
public void sendMail() {
	new Mailer(new ServerConfig("smtp.host.com", 587), TransportStrategy.SMTP_TLS).sendMail(email);
}
 
开发者ID:maugern,项目名称:jersey-skeleton,代码行数:5,代码来源:NewPasswordMail.java


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