javax.mail.internet.MimeMessage.getReceivedDate()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(237)

本文整理了Java中javax.mail.internet.MimeMessage.getReceivedDate()方法的一些代码示例,展示了MimeMessage.getReceivedDate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeMessage.getReceivedDate()方法的具体详情如下:
包路径:javax.mail.internet.MimeMessage
类名称:MimeMessage
方法名:getReceivedDate

MimeMessage.getReceivedDate介绍

[英]Returns the Date on this message was received. Returns null if this date cannot be obtained.

Note that RFC 822 does not define a field for the received date. Hence only implementations that can provide this date need return a valid value.

This implementation returns null.
[中]返回收到此邮件的日期。如果无法获取此日期,则返回null
请注意,RFC 822没有为接收日期定义字段。因此,只有能够提供此日期的实现才需要返回有效值。
此实现返回null

代码示例

代码示例来源:origin: apache/nifi

attributes.put(EMAIL_HEADER_MESSAGE_ID, originalMessage.getMessageID());
if (originalMessage.getReceivedDate() != null) {
  attributes.put(EMAIL_HEADER_RECV_DATE, originalMessage.getReceivedDate().toString());

代码示例来源:origin: spring-projects/spring-integration

@Override
public Date getReceivedDate() throws MessagingException {
  /*
   * Basic MimeMessage always returns null; delegate to the original.
   */
  return this.source.getReceivedDate();
}

代码示例来源:origin: spring-projects/spring-integration

headers.put(MailHeaders.LINE_COUNT, lineCount);
Date receivedDate = source.getReceivedDate();
if (receivedDate != null) {
  headers.put(MailHeaders.RECEIVED_DATE, receivedDate);

代码示例来源:origin: org.springframework.integration/spring-integration-mail

@Override
public Date getReceivedDate() throws MessagingException {
  /*
   * Basic MimeMessage always returns null; delegate to the original.
   */
  return this.source.getReceivedDate();
}

代码示例来源:origin: spring-projects/spring-integration

(org.springframework.messaging.Message<MimeMessage>) channel.receive(10000);
assertNotNull(received);
assertNotNull(received.getPayload().getReceivedDate());
assertTrue(received.getPayload().getLineCount() > -1);
if (simple) {

代码示例来源:origin: org.apache.james/james-server-core-library

/**
 * @see javax.mail.Message#getReceivedDate()
 */
public Date getReceivedDate() throws MessagingException {
  return getWrappedMessage().getReceivedDate();
}

代码示例来源:origin: stackoverflow.com

if (message.getReceivedDate() != null) {
  return message.getReceivedDate();

代码示例来源:origin: org.mnode.mstor/mstor

/**
 * {@inheritDoc}
 */
public Date getReceivedDate() throws MessagingException {
  if (delegate != null) {
    try {
      return delegate.getReceived();
    }
    catch (Exception e) {
      throw new MessagingException("Error retrieving received date", e);
    }
  }
  return super.getReceivedDate();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

/**
 * Construct an appropriately formatted UNIX From line using
 * the sender address and the date in the message.
 */
protected static String getUnixFrom(MimeMessage msg) {
Address[] afrom;
String from;
Date ddate;
String date;
try {
  if ((afrom = msg.getFrom()) == null ||
    !(afrom[0] instanceof InternetAddress) ||
    (from = ((InternetAddress)afrom[0]).getAddress()) == null)
  from = "UNKNOWN";
  if ((ddate = msg.getReceivedDate()) == null ||
    (ddate = msg.getSentDate()) == null)
  ddate = new Date();
} catch (MessagingException e) {
  from = "UNKNOWN";
  ddate = new Date();
}
date = ddate.toString();
// date is of the form "Sat Aug 12 02:30:00 PDT 1995"
// need to strip out the timezone
return "From " + from + " " +
  date.substring(0, 20) + date.substring(24);
}

代码示例来源:origin: io.milton/aspirin

/**
 * It gives back expiry value of a message in epoch milliseconds.
 *
 * @param message The MimeMessage which expiry is needed.
 * @return Expiry in milliseconds.
 */
public long getExpiry(MimeMessage message) {
  String headers[];
  try {
    headers = message.getHeader(Aspirin.HEADER_EXPIRY);
    if (headers != null && 0 < headers.length) {
      return expiryFormat.parse(headers[0]).getTime();
    }
  } catch (Exception e) {
    log.error("Expiration header could not be get from MimeMessage.", e);
  }
  if (configuration.getExpiry() == Configuration.NEVER_EXPIRES) {
    return Long.MAX_VALUE;
  }
  try {
    Date sentDate = message.getReceivedDate();
    if (sentDate != null) {
      return sentDate.getTime() + configuration.getExpiry();
    }
  } catch (MessagingException e) {
    log.error("Expiration calculation could not be based on message date.", e);
  }
  return System.currentTimeMillis() + configuration.getExpiry();
}

代码示例来源:origin: apache/ofbiz-framework

public Timestamp getReceivedDate() {
  MimeMessage message = getMessage();
  try {
    return UtilDateTime.toTimestamp(message.getReceivedDate());
  } catch (MessagingException e) {
    Debug.logError(e, module);
    return null;
  }
}

代码示例来源:origin: org.springframework.integration/spring-integration-mail

headers.put(MailHeaders.LINE_COUNT, lineCount);
Date receivedDate = source.getReceivedDate();
if (receivedDate != null) {
  headers.put(MailHeaders.RECEIVED_DATE, receivedDate);

代码示例来源:origin: apache/ofbiz-framework

} else if ("received-date".equals(fieldName)) {
  values = new String[1];
  values[0] = message.getReceivedDate().toString();
} else if ("body".equals(fieldName)) {
  List<String> bodyParts = this.getBodyText(message);

代码示例来源:origin: org.apache.nifi/nifi-email-processors

attributes.put(EMAIL_HEADER_MESSAGE_ID, originalMessage.getMessageID());
if (originalMessage.getReceivedDate() != null) {
  attributes.put(EMAIL_HEADER_RECV_DATE, originalMessage.getReceivedDate().toString());

代码示例来源:origin: apache/ofbiz-framework

public static Map<String, Object> mcaTest(DispatchContext dctx, Map<String, ?> context) {
  MimeMessageWrapper wrapper = (MimeMessageWrapper) context.get("messageWrapper");
  MimeMessage message = wrapper.getMessage();
  try {
    if (message.getAllRecipients() != null) {
      Debug.logInfo("To: " + UtilMisc.toListArray(message.getAllRecipients()), module);
    }
    if (message.getFrom() != null) {
      Debug.logInfo("From: " + UtilMisc.toListArray(message.getFrom()), module);
    }
    Debug.logInfo("Subject: " + message.getSubject(), module);
    if (message.getSentDate() != null) {
      Debug.logInfo("Sent: " + message.getSentDate().toString(), module);
    }
    if (message.getReceivedDate() != null) {
      Debug.logInfo("Received: " + message.getReceivedDate().toString(), module);
    }
  } catch (Exception e) {
    Debug.logError(e, module);
  }
  return ServiceUtil.returnSuccess();
}

代码示例来源:origin: stackoverflow.com

if (mime.getReceivedDate() != null)
  finalMessage = finalMessage + "Received: " + mime.getReceivedDate() + "\n\n";
else
  finalMessage = finalMessage + "\n";

代码示例来源:origin: org.alfresco/alfresco-repository

Date rxDate = mimeMessage.getReceivedDate();

代码示例来源:origin: org.apache.james/james-server-mailets

LOGGER.info("Received: " + message.getReceivedDate());
LOGGER.info("Sent: " + message.getSentDate());

代码示例来源:origin: Alfresco/alfresco-repository

Date rxDate = mimeMessage.getReceivedDate();

代码示例来源:origin: com.qwazr/qwazr-library-email

document.add(PLAIN_CONTENT, mimeMessageParser.getPlainContent());
document.add(SENT_DATE, mimeMessage.getSentDate());
document.add(RECEIVED_DATE, mimeMessage.getReceivedDate());

相关文章

MimeMessage类方法