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


Java Destination.setBccAddresses方法代码示例

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


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

示例1: buildContent

import com.amazonaws.services.simpleemail.model.Destination; //导入方法依赖的package包/类
/**
 * Builds email content to be sent using an email sender.
 * @param message instance where content must be set.
 * @throws EmailException if setting mail content fails.
 */
@Override
protected void buildContent(Message message) throws EmailException {
    Destination destination = new Destination(getTo());
    if (getBCC() != null && !getBCC().isEmpty()) {
        destination.setBccAddresses(getBCC());
    }
    if (getCC() != null && !getCC().isEmpty()) {
        destination.setCcAddresses(getCC());
    }
            
    if (getSubject() != null) {
        Content subject = new Content(getSubject());
        //set utf-8 enconding to support all languages
        subject.setCharset("UTF-8"); 
        message.setSubject(subject);
    }
            
    if (getText() != null) {
        Body body = new Body();
        Content content = new Content(getText());
        //set utf-8 enconding to support all languages            
        content.setCharset("UTF-8"); 
    
        body.setText(content);
        message.setBody(body);
    }
}
 
开发者ID:albertoirurueta,项目名称:irurueta-server-commons-email,代码行数:33,代码来源:AWSTextEmailMessage.java

示例2: sendTextEmail

import com.amazonaws.services.simpleemail.model.Destination; //导入方法依赖的package包/类
/**
 * Method to send a text email.
 * @param m email message to be sent.
 * @return id of message that has been sent.
 * @throws MailNotSentException if mail couldn't be sent.
 */    
private String sendTextEmail(AWSTextEmailMessage m) 
        throws MailNotSentException {
    String messageId;
    long currentTimestamp = System.currentTimeMillis();        
    prepareClient();
    if (!mEnabled) {
        //don't send message if not enabled
        return null;
    } 
    
    try {
        synchronized (this) { 
            //prevents throttling
            checkQuota(currentTimestamp);
            
            Destination destination = new Destination(m.getTo());
            if (m.getBCC() != null && !m.getBCC().isEmpty()) {
                destination.setBccAddresses(m.getBCC());
            }
            if (m.getCC() != null && !m.getCC().isEmpty()) {
                destination.setCcAddresses(m.getCC());
            }
            
            //if no subject, set to empty string to avoid errors
            if (m.getSubject() == null) {
                m.setSubject("");
            }
            
            Message message = new Message();
            m.buildContent(message);
                            
            SendEmailResult result = mClient.sendEmail(new SendEmailRequest(mMailFromAddress, destination, 
                    message));
            messageId = result.getMessageId();
            //update timestamp of last sent email
            mLastSentMailTimestamp = System.currentTimeMillis();
            
            //wait to avoid throwttling exceptions to avoid making any
            //further requests
            this.wait(mWaitIntervalMillis);
        }
    } catch (Throwable t) {
        throw new MailNotSentException(t);
    }      
    return messageId;
}
 
开发者ID:albertoirurueta,项目名称:irurueta-server-commons-email,代码行数:53,代码来源:AWSMailSender.java


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