Package dev.gmitch215.bytebox
Interface InboundMail
public interface InboundMail
An incoming email message, which records what a handler did with it.
Cloudflare drops a message that a handler returns without acting on, so this type keeps the disposition rather than making the handler return one. Act at any point and carry on:
public void email(InboundMail mail, Env env, ExecutionCtx ctx) {
mail.reply(acknowledgement(mail));
audit(env, mail.from());
mail.forward("[email protected]");
}
Inbound messages are capped at 25 MiB. A reply is refused unless the original passed DMARC,
the recipient matches the original sender, the sending domain matches the receiving domain, only
one reply is sent per message, and the References header holds fewer than 100 entries.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns what has been done with this message so far.voiddrop()Discards the message on purpose.voidSends the message on to a verified destination address.from()Returns the envelope sender.headers()Returns the message headers.raw()Returns the raw MIME message.intrawSize()Returns the size of the raw message in bytes.voidRefuses the message with a permanent SMTP error.voidAnswers the message in the same SMTP session.to()Returns the envelope recipient.
-
Method Details
-
from
String from()Returns the envelope sender.- Returns:
- the envelope sender
-
to
String to()Returns the envelope recipient.- Returns:
- the envelope recipient
-
headers
Headers headers()Returns the message headers.- Returns:
- the message headers
-
rawSize
int rawSize()Returns the size of the raw message in bytes.- Returns:
- the size of the raw message in bytes
-
raw
String raw()Returns the raw MIME message.- Returns:
- the raw MIME message
-
disposition
MailAction disposition()Returns what has been done with this message so far.- Returns:
- what has been done with this message so far
-
forward
Sends the message on to a verified destination address.- Parameters:
address- the destination
-
reply
Answers the message in the same SMTP session.- Parameters:
mime- the reply, as a raw MIME message
-
reject
Refuses the message with a permanent SMTP error.- Parameters:
reason- the reason, returned to the sending server
-
drop
void drop()Discards the message on purpose.
-