java.lang.Object
i2p.susi.webmail.smtp.SMTPClient
SMTP client for sending email through SMTP servers over I2P. Supports command pipelining, attachments, and size limits optimized for I2P. Includes base64 size calculations and 8BITMIME support for efficient I2P mail delivery.
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long7629902 ~= 7.27 MB Base64 encodes 57 chars to 76 + \r\n on a line.static final long10.00 MB smtp.postman.i2p as of 2024-06-22.Error message from the last failed operation, or empty if none.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionbooleansendMail(String host, int port, String user, String pass, String sender, List<String> recipients, StringBuilder body, List<Attachment> attachments, String boundary) Sends one message to an SMTP server, authenticating first when a user name is given.static voidwriteMail(Writer out, StringBuilder body, List<Attachment> attachments, String boundary) Caller must close out.
Field Details
DEFAULT_MAX_SIZE
public static final long DEFAULT_MAX_SIZE10.00 MB smtp.postman.i2p as of 2024-06-22.- See Also:
BINARY_MAX_SIZE
public static final long BINARY_MAX_SIZE7629902 ~= 7.27 MB Base64 encodes 57 chars to 76 + \r\n on a line.- See Also:
error
Error message from the last failed operation, or empty if none.
Constructor Details
SMTPClient
public SMTPClient()Creates a client with no error.
Method Details
sendMail
public boolean sendMail(String host, int port, String user, String pass, String sender, List<String> recipients, StringBuilder body, List<Attachment> attachments, String boundary) Sends one message to an SMTP server, authenticating first when a user name is given. Any failure is appended to the error field rather than thrown.- Parameters:
host- the SMTP server to connect toport- the SMTP server port to connect touser- the AUTH LOGIN user name, base64-encoded on the wirepass- the AUTH LOGIN password, base64-encoded on the wiresender- the envelope sender, sent as MAIL FROMrecipients- the envelope recipients, sent as one RCPT TO eachbody- headers and body, without the attachmentsattachments- may be nullboundary- non-null if attachments is non-null- Returns:
- true if the server accepted the message, false if any step failed
writeMail
public static void writeMail(Writer out, StringBuilder body, List<Attachment> attachments, String boundary) throws IOException Caller must close out.- Parameters:
out- the writer that receives the message, left open for the callerbody- headers and body, without the attachmentsattachments- may be nullboundary- non-null if attachments is non-null- Throws:
IOException- if the socket write or the attachment encoding fails