public String getOnMatchException() { return mailet.getMailetConfig() .getInitParameter("onMatchException"); }
public Collection<MailAddress> match(Mail mail) throws MessagingException { if (mail.getMessageSize() > cutoff) { return mail.getRecipients(); } else { return null; } } }
@Override public Collection<MailAddress> match(Mail mail) throws MessagingException { return mail.getRecipients(); } });
private String locateFolder(String username, Mail mail) { if (mail.getAttribute(DELIVERY_PATH_PREFIX + username) instanceof String) { return (String) mail.getAttribute(DELIVERY_PATH_PREFIX + username); } return folder; }
@Override public void service(Mail mail) throws MessagingException { mail.setAttribute(MailPrioritySupport.MAIL_PRIORITY, priority); } }
@Override public void service(Mail mail) throws MessagingException { String state = config.getInitParameter("state"); mail.setState(state); } }
@SuppressWarnings("deprecated") // This will be handled in a followup pull request See JAMES-2557 @Override public MailAddress getSender() { return mail.getSender(); }
/** * Set this mail to GHOST state, indicating that no further processing * should take place. * * @param mail the mail to process */ public void service(Mail mail) { mail.setState(Mail.GHOST); }
private String computeGatewayUser(MailetConfig mailetConfig) { // backward compatibility with 2.3.x String user = mailetConfig.getInitParameter(GATEWAY_USERNAME); if (user == null) { return mailetConfig.getInitParameter(GATEWAY_USERNAME_COMPATIBILITY); } return user; }
private void addSpecificHeadersForRecipient(Mail mail, MimeMessage message, MailAddress recipient) throws MessagingException { for (Header header: mail.getPerRecipientSpecificHeaders().getHeadersForRecipient(recipient)) { message.addHeader(header.getName(), header.getValue()); } } }
public String getMailetName() { return mailet.getMailetConfig().getMailetName(); }
/** * (non-Javadoc) * @see org.apache.james.protocols.smtp.MailEnvelope#setRecipients(java.util.List) */ public void setRecipients(List<MailAddress> recipientCollection) { mail.setRecipients(recipientCollection); }
/** * Returns the name of this matcher instance. * * @return the name of this matcher instance */ @Override public String getMatcherName() { return config.getMatcherName(); }
@Override public Serializable<TestArbitrarySerializable> serialize() { return new Serializable<>(AttributeValue.of(value), Factory.class); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public static AttributeValue<Map<String, AttributeValue<?>>> of(Map<String, AttributeValue<?>> value) { Preconditions.checkNotNull(value, "value should not be null"); return new AttributeValue<>(value, new Serializer.MapSerializer()); }
private String getDeliveryError(Mail originalMail) { String deliveryError = (String) originalMail.getAttribute("delivery-error"); if (deliveryError != null) { return deliveryError; } return "unknown"; }
/** * (non-Javadoc) * @see org.apache.james.protocols.smtp.MailEnvelope#getSender() */ public MailAddress getSender() { return mail.getSender(); }