本文整理了Java中org.apache.mailet.Mail.setState()
方法的一些代码示例,展示了Mail.setState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mail.setState()
方法的具体详情如下:
包路径:org.apache.mailet.Mail
类名称:Mail
方法名:setState
[英]Sets the state of this message.
[中]设置此消息的状态。
代码示例来源:origin: org.apache.james/apache-standard-mailets
/**
* 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);
}
代码示例来源:origin: org.apache.james/apache-standard-mailets
/**
* Count processed mails, marking each mail as completed after counting.
*
* @param mail the mail to process
*/
public void service(Mail mail) {
counter++;
log(counter + "");
mail.setState(Mail.GHOST);
}
代码示例来源:origin: org.apache.james/james-server-mailetcontainer-camel
@Override
public void service(Mail mail) {
if (!(Mail.ERROR.equals(mail.getState()))) {
// Don't complain if we fall off the end of the
// error processor. That is currently the
// normal situation for James, and the message
// will show up in the error store.
LOGGER.warn("Message {} reached the end of this processor, and is automatically deleted. " +
"This may indicate a configuration error.", mail.getName());
}
// Set the mail to ghost state
mail.setState(Mail.GHOST);
}
代码示例来源:origin: org.apache.james/james-server-mailets
@Override
public void service(Mail mail) throws javax.mail.MessagingException {
String logBuffer = "Storing mail " + mail.getName() + " in " + repositoryPath;
LOGGER.info(logBuffer);
repository.store(mail);
if (!passThrough) {
mail.setState(Mail.GHOST);
}
}
代码示例来源:origin: org.apache.james/james-server-mailets
/**
* Delivers a mail to a local mailbox in a given folder.
*/
@Override
public void service(Mail mail) throws MessagingException {
if (!mail.getState().equals(Mail.GHOST)) {
doService(mail);
if (consume) {
mail.setState(Mail.GHOST);
}
}
}
代码示例来源:origin: org.apache.james/james-server-mailetcontainer-camel
@Override
public void sendMail(Mail mail, String state) throws MessagingException {
mail.setAttribute(Mail.SENT_BY_MAILET, "true");
mail.setState(state);
rootMailQueue.enQueue(mail);
}
代码示例来源:origin: org.apache.james/james-server-mailetcontainer-camel
@Override
public void sendMail(Mail mail, String state, long delay, TimeUnit unit) throws MessagingException {
mail.setAttribute(Mail.SENT_BY_MAILET, "true");
mail.setState(state);
rootMailQueue.enQueue(mail, delay, unit);
}
代码示例来源:origin: org.apache.james/james-server-mailets
@Override
public void service(Mail mail) throws MessagingException {
String domain = mail.getMaybeSender()
.asOptional()
.map(MailAddress::getDomain)
.map(Domain::asString)
.orElse("");
MailRepositoryUrl repositoryUrl = MailRepositoryUrl.from(urlPrefix + domain);
store(mail, repositoryUrl);
if (!passThrough) {
mail.setState(Mail.GHOST);
}
}
代码示例来源:origin: org.apache.james/apache-standard-mailets
log(logBuffer.toString());
mail.setState(processor);
if (noticeText != null) {
if (mail.getErrorMessage() == null) {
代码示例来源:origin: org.apache.james/james-server-mailets
private void passThrough(Mail originalMail) throws MessagingException {
if (getInitParameters().isDebug()) {
LOGGER.debug("Processing a bounce request for a message with an empty reverse-path. No bounce will be sent.");
}
if (!getInitParameters().getPassThrough()) {
originalMail.setState(Mail.GHOST);
}
}
代码示例来源:origin: org.apache.james/james-server-mailetcontainer-api
@Override
public void service(Mail mail) throws MessagingException {
if (shouldThrow) {
throw new MessagingException();
} else {
mail.setState(newState);
}
}
}
代码示例来源:origin: org.apache.james/james-server-mailetcontainer-api
@Override
public void service(Mail mail) throws MessagingException {
String state = config.getInitParameter("state");
mail.setState(state);
}
}
代码示例来源:origin: org.apache.james/james-server-mailets
private void handleTemporaryFailure(Mail mail, ExecutionResult executionResult) throws MailQueue.MailQueueException {
if (!mail.getState().equals(Mail.ERROR)) {
mail.setState(Mail.ERROR);
DeliveryRetriesHelper.initRetries(mail);
mail.setLastUpdated(dateSupplier.get());
}
int retries = DeliveryRetriesHelper.retrieveRetries(mail);
if (retries < configuration.getMaxRetries()) {
reAttemptDelivery(mail, retries);
} else {
LOGGER.debug("Bouncing message {} after {} retries", mail.getName(), retries);
bouncer.bounce(mail, new Exception("Too many retries failure. Bouncing after " + retries + " retries.", executionResult.getException().orElse(null)));
}
}
代码示例来源:origin: org.apache.james/james-server-mailets
@Override
public void service(Mail originalMail) throws MessagingException {
if (hasSender(originalMail)) {
trySendBounce(originalMail);
}
if (!getInitParameters().getPassThrough()) {
originalMail.setState(Mail.GHOST);
}
}
代码示例来源:origin: org.nhind/xdmail
mail.setState(Mail.GHOST);
代码示例来源:origin: org.apache.james/apache-jsieve-mailet
/**
* Method execute executes the passed ActionRedirect.
*
* @param anAction not nul
* @param aMail not null
* @param context not null
* @throws MessagingException
*/
public void execute(ActionRedirect anAction, Mail aMail, ActionContext context) throws MessagingException
{
ActionUtils.detectAndHandleLocalLooping(aMail, context, "redirect");
Collection<MailAddress> recipients = new ArrayList<MailAddress>(1);
recipients.add(new MailAddress(new InternetAddress(anAction.getAddress())));
MailAddress sender = aMail.getSender();
context.post(sender, recipients, aMail.getMessage());
aMail.setState(Mail.GHOST);
Log log = context.getLog();
if (log.isDebugEnabled()) {
log.debug("Redirected Message ID: "
+ aMail.getMessage().getMessageID() + " to \""
+ anAction.getAddress() + "\"");
}
}
}
代码示例来源:origin: org.nhind/gateway
mail.setState(Mail.GHOST);
代码示例来源:origin: org.apache.james/james-server-mailets
@Override
public void service(Mail mail) throws MessagingException {
if (configuration.isDebug()) {
LOGGER.debug("Remotely delivering mail {}", mail.getName());
}
if (configuration.isUsePriority()) {
mail.setAttribute(MailPrioritySupport.MAIL_PRIORITY, MailPrioritySupport.HIGH_PRIORITY);
}
if (!mail.getRecipients().isEmpty()) {
if (configuration.getGatewayServer().isEmpty()) {
serviceNoGateway(mail);
} else {
serviceWithGateway(mail);
}
} else {
LOGGER.debug("Mail {} from {} has no recipients and can not be remotely delivered", mail.getName(), mail.getMaybeSender());
}
mail.setState(Mail.GHOST);
}
代码示例来源:origin: org.apache.james/james-server-mailets
public void processMail(Mail mail) throws MessagingException {
RrtExecutionResult executionResults = executeRrtFor(mail);
if (!executionResults.recipientWithError.isEmpty()) {
MailImpl newMail = MailImpl.builder()
.name(mail.getName())
.sender(mail.getMaybeSender())
.recipients(executionResults.recipientWithError)
.mimeMessage(mail.getMessage())
.state(errorProcessor)
.build();
mailetContext.sendMail(newMail);
}
if (executionResults.newRecipients.isEmpty()) {
mail.setState(Mail.GHOST);
}
mail.setRecipients(executionResults.newRecipients);
}
代码示例来源:origin: org.apache.james/james-server-mailets
public void dispatch(Mail mail) throws MessagingException {
List<MailAddress> errors = customizeHeadersAndDeliver(mail);
if (!errors.isEmpty()) {
// If there were errors, we redirect the email to the ERROR
// processor.
// In order for this server to meet the requirements of the SMTP
// specification, mails on the ERROR processor must be returned to
// the sender. Note that this email doesn't include any details
// regarding the details of the failure(s).
// In the future we may wish to address this.
Mail newMail = MailImpl.builder()
.sender(mail.getMaybeSender())
.recipients(errors)
.mimeMessage(mail.getMessage())
.state(Mail.ERROR)
.build();
mailetContext.sendMail(newMail);
}
if (consume) {
// Consume this message
mail.setState(Mail.GHOST);
}
}
内容来源于网络,如有侵权,请联系作者删除!