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


Java Email.addReplyTo方法代码示例

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


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

示例1: buildMessage

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
/**
 *
 */
public static Email buildMessage(Email email) throws EmailException {

    String from = GojaConfig.getProperty("mail.smtp.from");
    if (email.getFromAddress() == null && !StringUtils.isEmpty(from)) {
        email.setFrom(from);
    } else if (email.getFromAddress() == null) {
        throw new MailException("Please define a 'from' email address", new NullPointerException());
    }
    if ((email.getToAddresses() == null || email.getToAddresses().size() == 0) &&
            (email.getCcAddresses() == null || email.getCcAddresses().size() == 0) &&
            (email.getBccAddresses() == null || email.getBccAddresses().size() == 0)) {
        throw new MailException("Please define a recipient email address",
                new NullPointerException());
    }
    if (email.getSubject() == null) {
        throw new MailException("Please define a subject", new NullPointerException());
    }
    if (email.getReplyToAddresses() == null || email.getReplyToAddresses().size() == 0) {
        email.addReplyTo(email.getFromAddress().getAddress());
    }

    return email;
}
 
开发者ID:GojaFramework,项目名称:goja,代码行数:27,代码来源:EMail.java

示例2: buildMessage

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
/**
 *
 */
public static Email buildMessage(Email email) throws EmailException {

    String from = Play.configuration.getProperty("mail.smtp.from");
    if (email.getFromAddress() == null && !StringUtils.isEmpty(from)) {
        email.setFrom(from);
    } else if (email.getFromAddress() == null) {
        throw new MailException("Please define a 'from' email address", new NullPointerException());
    }
    if ((email.getToAddresses() == null || email.getToAddresses().size() == 0) &&
        (email.getCcAddresses() == null || email.getCcAddresses().size() == 0)  &&
        (email.getBccAddresses() == null || email.getBccAddresses().size() == 0)) 
    {
        throw new MailException("Please define a recipient email address", new NullPointerException());
    }
    if (email.getSubject() == null) {
        throw new MailException("Please define a subject", new NullPointerException());
    }
    if (email.getReplyToAddresses() == null || email.getReplyToAddresses().size() == 0) {
        email.addReplyTo(email.getFromAddress().getAddress());
    }

    return email;
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:27,代码来源:Mail.java

示例3: setupEmail

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
private static void setupEmail(Email mail, String to, String subject, String template, Map<String, Object> body) throws EmailException {
    mail.setHostName(Configuration.getSmtpHostname());
    mail.setFrom(Configuration.getSmtpFrom(), "DisplayDirect");
    if (Configuration.getSmtpUsername() != null && Configuration.getSmtpPassword() != null) {
        mail.setAuthenticator(new DefaultAuthenticator(Configuration.getSmtpUsername(), Configuration.getSmtpPassword()));
    }
    if (Configuration.getSmtpSsl()) {
        mail.setSSLOnConnect(true); // Setting this changes the port to 465
    }
    mail.setSmtpPort(Configuration.getSmtpPort());

    mail.addReplyTo(Configuration.getSmtpReplyTo(), "DisplayDirect");
    mail.setSubject(subject);
    addEmailTo(mail, to);
}
 
开发者ID:CROW-NDOV,项目名称:displaydirect,代码行数:16,代码来源:EmailUtil.java


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