本文整理汇总了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);
}
}
示例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;
}