Class MailDelivery
java.lang.Object
com.iizix.server.user.MailDelivery
The delivery of a mail a user is waiting for (CC-FIX-SIGNIN-ACCOUNT-MAIL): the mail is SENT now, not queued, so that the answer the user reads follows what the relay did - "Sent" when the relay accepted it, "not sent" with the reason when it refused it or could not be reached. The wait is bounded (
BOUND_MS): a relay that has not answered within the bound is left to finish in the background, and the mail is answered as sent with a WARNING in the log, so that a hung relay never hangs a screen.The mails nobody waits for (the notices, the sign-up's verification mail) stay on the queue (Mail.queue()), where a refusal is a WARNING of the queue thread.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longHow long a send waits for the relay before the mail is answered as sent and left to the background: 20 seconds.static final AccountEmailChange.IMailStepThe delivery step that sends now, bounded byBOUND_MS: for the engines that take anAccountEmailChange.IMailStep(VerificationMails,AdminAccountChanges).Method Summary
Modifier and TypeMethodDescriptionstatic booleansendBounded(Mail mail) Sends a mail now and waits at mostBOUND_MSfor the relay.static booleansendBounded(Mail mail, long boundMs) Sends a mail now and waits at most a bound for the relay.
Field Details
BOUND_MS
public static final long BOUND_MSHow long a send waits for the relay before the mail is answered as sent and left to the background: 20 seconds.- See Also:
SEND_NOW
The delivery step that sends now, bounded byBOUND_MS: for the engines that take anAccountEmailChange.IMailStep(VerificationMails,AdminAccountChanges).
Method Details
sendBounded
Sends a mail now and waits at mostBOUND_MSfor the relay.- Parameters:
mail- The mail, built and not yet sent or queued.- Returns:
- true when the relay accepted it, or when it has not answered within the bound (logged); false when the mail was already sent or queued.
- Throws:
MessagingException- When the relay refused the mail or could not be reached.
sendBounded
Sends a mail now and waits at most a bound for the relay.- Parameters:
mail- The mail, built and not yet sent or queued.boundMs- The bound in milliseconds.- Returns:
- true when the relay accepted it, or when it has not answered within the bound (logged); false when the mail was already sent or queued.
- Throws:
MessagingException- When the relay refused the mail or could not be reached.