本文整理了Java中org.apache.mailet.Mail.getErrorMessage()
方法的一些代码示例,展示了Mail.getErrorMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mail.getErrorMessage()
方法的具体详情如下:
包路径:org.apache.mailet.Mail
类名称:Mail
方法名:getErrorMessage
[英]The error message, if any, associated with this message.
[中]与此消息关联的错误消息(如果有)。
代码示例来源:origin: org.apache.james/james-server-mailets
private MimeBodyPart getErrorPart(Mail originalMail) throws MessagingException {
MimeBodyPart errorPart = new MimeBodyPart();
errorPart.setContent(originalMail.getErrorMessage(), "text/plain");
errorPart.setHeader(RFC2822Headers.CONTENT_TYPE, "text/plain");
errorPart.setFileName("Reasons");
errorPart.setDisposition(javax.mail.Part.ATTACHMENT);
return errorPart;
}
代码示例来源:origin: org.apache.james/apache-standard-mailets
if (mail.getErrorMessage() == null) {
mail.setErrorMessage(noticeText);
} else {
StringBuffer errorMessageBuffer =
new StringBuffer(256)
.append(mail.getErrorMessage())
.append("\r\n")
.append(noticeText);
代码示例来源: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-mailets
if (originalMail.getErrorMessage() != null) {
builder.append(LINE_BREAK)
.append("Error message below:")
.append(LINE_BREAK)
.append(originalMail.getErrorMessage())
.append(LINE_BREAK);
代码示例来源:origin: org.apache.james/james-server-queue-jms
map.put(names[6], m.getRemoteAddr());
map.put(names[7], m.getRemoteHost());
map.put(names[8], m.getErrorMessage());
Map<String, String> attrs = new HashMap<>();
Iterator<String> attrNames = m.getAttributeNames();
代码示例来源: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/apache-standard-mailets
String errorMessage = mail.getErrorMessage();
if (errorMessage == null) {
errorMessage = "";
代码示例来源:origin: org.apache.james/james-server-mailets
private MimeMultipart generateMultipartContent(MimeMessage originalMessage, String head) throws Exception {
// Create the message body
MimeMultipart multipart = new MimeMultipart("mixed");
// Create the message
MimeMultipart mpContent = new MimeMultipart("alternative");
mpContent.addBodyPart(getBodyPart(originalMail, originalMessage, head));
MimeBodyPart contentPartRoot = new MimeBodyPart();
contentPartRoot.setContent(mpContent);
multipart.addBodyPart(contentPartRoot);
if (mailet.getInitParameters().isDebug()) {
LOGGER.debug("attachmentType:{}", mailet.getInitParameters().getAttachmentType());
}
if (!mailet.getInitParameters().getAttachmentType().equals(TypeCode.NONE)) {
multipart.addBodyPart(getAttachmentPart(originalMessage, head));
}
if (mailet.getInitParameters().isAttachError() && originalMail.getErrorMessage() != null) {
multipart.addBodyPart(getErrorPart(originalMail));
}
return multipart;
}
代码示例来源: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-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-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());
}));
}
内容来源于网络,如有侵权,请联系作者删除!