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