本文整理了Java中org.apache.mailet.Mail.getLastUpdated()
方法的一些代码示例,展示了Mail.getLastUpdated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mail.getLastUpdated()
方法的具体详情如下:
包路径:org.apache.mailet.Mail
类名称:Mail
方法名:getLastUpdated
[英]Returns the time at which this Mail was last updated.
[中]返回此邮件上次更新的时间。
代码示例来源:origin: org.apache.james/james-server-mailets
private MimeBodyPart createDSN(Mail originalMail) throws MessagingException {
StringBuffer buffer = new StringBuffer();
appendReportingMTA(buffer);
buffer.append("Received-From-MTA: dns; " + originalMail.getRemoteHost())
.append(LINE_BREAK);
for (MailAddress rec : originalMail.getRecipients()) {
appendRecipient(buffer, rec, getDeliveryError(originalMail), originalMail.getLastUpdated());
}
MimeBodyPart bodyPart = new MimeBodyPart();
bodyPart.setContent(buffer.toString(), "text/plain");
bodyPart.setHeader("Content-Type", "message/delivery-status");
bodyPart.setDescription("Delivery Status Notification");
bodyPart.setFileName("status.dat");
return bodyPart;
}
代码示例来源:origin: org.apache.james/james-server-queue-jms
protected Map<String, Object> getJMSProperties(Mail mail, long nextDelivery) throws MessagingException {
Map<String, Object> props = new HashMap<>();
props.put(JAMES_NEXT_DELIVERY, nextDelivery);
props.put(JAMES_MAIL_ERROR_MESSAGE, mail.getErrorMessage());
props.put(JAMES_MAIL_LAST_UPDATED, mail.getLastUpdated().getTime());
props.put(JAMES_MAIL_MESSAGE_SIZE, mail.getMessageSize());
props.put(JAMES_MAIL_NAME, mail.getName());
// won't serialize the empty headers so it is mandatory
// to handle nulls when reconstructing mail from message
if (!mail.getPerRecipientSpecificHeaders().getHeadersByRecipient().isEmpty()) {
props.put(JAMES_MAIL_PER_RECIPIENT_HEADERS, SerializationUtil.serialize(mail.getPerRecipientSpecificHeaders()));
}
String recipientsAsString = joiner.join(mail.getRecipients());
props.put(JAMES_MAIL_RECIPIENTS, recipientsAsString);
props.put(JAMES_MAIL_REMOTEADDR, mail.getRemoteAddr());
props.put(JAMES_MAIL_REMOTEHOST, mail.getRemoteHost());
String sender = mail.getMaybeSender().asString("");
org.apache.james.util.streams.Iterators.toStream(mail.getAttributeNames())
.forEach(attrName -> props.put(attrName, SerializationUtil.serialize(mail.getAttribute(attrName))));
props.put(JAMES_MAIL_ATTRIBUTE_NAMES, joiner.join(mail.getAttributeNames()));
props.put(JAMES_MAIL_SENDER, sender);
props.put(JAMES_MAIL_STATE, mail.getState());
return props;
}
代码示例来源:origin: org.apache.james/james-server-queue-jms
map.put(names[5], m.getLastUpdated().getTime());
map.put(names[6], m.getRemoteAddr());
map.put(names[7], m.getRemoteHost());
代码示例来源:origin: org.apache.james/james-server-webadmin-mailrepository
public static MailDto fromMail(Mail mail, Set<AdditionalField> additionalFields) throws MessagingException, InaccessibleFieldException {
Optional<MessageContent> messageContent = fetchMessage(additionalFields, mail);
return new MailDto(mail.getName(),
mail.getMaybeSender().asOptional().map(MailAddress::asString),
mail.getRecipients().stream().map(MailAddress::asString).collect(Guavate.toImmutableList()),
Optional.ofNullable(mail.getErrorMessage()),
Optional.ofNullable(mail.getState()),
Optional.ofNullable(mail.getRemoteHost()),
Optional.ofNullable(mail.getRemoteAddr()),
Optional.ofNullable(mail.getLastUpdated()),
fetchAttributes(additionalFields, mail),
fetchPerRecipientsHeaders(additionalFields, mail),
fetchHeaders(additionalFields, mail),
fetchTextBody(additionalFields, messageContent),
fetchHtmlBody(additionalFields, messageContent),
fetchMessageSize(additionalFields, mail));
}
代码示例来源:origin: org.apache.james/james-server-core-library
/**
* @param mail
* @param newName
* @throws MessagingException
*/
public MailImpl(Mail mail, String newName) throws MessagingException {
this(newName, mail.getSender(), mail.getRecipients(), mail.getMessage());
setRemoteHost(mail.getRemoteHost());
setRemoteAddr(mail.getRemoteAddr());
setLastUpdated(mail.getLastUpdated());
try {
if (mail instanceof MailImpl) {
setAttributesRaw((HashMap) cloneSerializableObject(((MailImpl) mail).getAttributesRaw()));
} else {
HashMap attribs = new HashMap();
for (Iterator i = mail.getAttributeNames(); i.hasNext(); ) {
String hashKey = (String) i.next();
attribs.put(hashKey,cloneSerializableObject(mail.getAttribute(hashKey)));
}
setAttributesRaw(attribs);
}
} catch (IOException e) {
// should never happen for in memory streams
setAttributesRaw(new HashMap());
} catch (ClassNotFoundException e) {
// should never happen as we just serialized it
setAttributesRaw(new HashMap());
}
}
代码示例来源:origin: org.apache.james/james-server-mailets
LOGGER.info("Last updated: " + mail.getLastUpdated());
LOGGER.info("Remote Address: " + mail.getRemoteAddr());
LOGGER.info("Remote Host: " + mail.getRemoteHost());
代码示例来源:origin: org.apache.james/james-server-jcr
/**
* Writes the mail message to the given mail node.
*
* @param node
* mail node
* @param mail
* mail message
* @throws MessagingException
* if a messaging error occurs
* @throws RepositoryException
* if a repository error occurs
* @throws IOException
* if an IO error occurs
*/
private void setMail(Node node, Mail mail) throws MessagingException, RepositoryException, IOException {
setState(node, mail.getState());
setLastUpdated(node, mail.getLastUpdated());
setError(node, mail.getErrorMessage());
setRemoteHost(node, mail.getRemoteHost());
setRemoteAddr(node, mail.getRemoteAddr());
setSender(node, mail.getSender());
setRecipients(node, mail.getRecipients());
setMessage(node, mail.getMessage());
setAttributes(node, mail);
}
代码示例来源:origin: org.apache.james/james-server-data-jcr
/**
* Writes the mail message to the given mail node.
*
* @param node
* mail node
* @param mail
* mail message
* @throws MessagingException
* if a messaging error occurs
* @throws RepositoryException
* if a repository error occurs
* @throws IOException
* if an IO error occurs
*/
private void setMail(Node node, Mail mail) throws MessagingException, RepositoryException, IOException {
setState(node, mail.getState());
setLastUpdated(node, mail.getLastUpdated());
setError(node, mail.getErrorMessage());
setRemoteHost(node, mail.getRemoteHost());
setRemoteAddr(node, mail.getRemoteAddr());
setSender(node, mail.getMaybeSender());
setRecipients(node, mail.getRecipients());
setMessage(node, mail.getMessage());
setAttributes(node, mail);
}
代码示例来源:origin: org.apache.james/james-server-mailrepository-api
default void checkMailEquality(Mail actual, Mail expected) {
assertSoftly(Throwing.consumer(softly -> {
softly.assertThat(actual.getMessage().getContent()).isEqualTo(expected.getMessage().getContent());
softly.assertThat(actual.getMessageSize()).isEqualTo(expected.getMessageSize());
softly.assertThat(actual.getName()).isEqualTo(expected.getName());
softly.assertThat(actual.getState()).isEqualTo(expected.getState());
softly.assertThat(actual.getAttribute(TEST_ATTRIBUTE)).isEqualTo(expected.getAttribute(TEST_ATTRIBUTE));
softly.assertThat(actual.getErrorMessage()).isEqualTo(expected.getErrorMessage());
softly.assertThat(actual.getRemoteHost()).isEqualTo(expected.getRemoteHost());
softly.assertThat(actual.getRemoteAddr()).isEqualTo(expected.getRemoteAddr());
softly.assertThat(actual.getLastUpdated()).isEqualTo(expected.getLastUpdated());
softly.assertThat(actual.getPerRecipientSpecificHeaders()).isEqualTo(expected.getPerRecipientSpecificHeaders());
}));
}
内容来源于网络,如有侵权,请联系作者删除!