Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public static final class Mail.Builder
- Object
- Mail.Builder
Collects a mail’s parts;
build checks them.Methods
Inherited methods
Method details
from
public Mail.Builder from(String address)The sender. Without one the mail is sent from
cn1.mail.from.replyTo
public Mail.Builder replyTo(String address)Where a reply goes when that is not the sender.
to
public Mail.Builder to(String... addresses)Adds recipients.
cc
public Mail.Builder cc(String... addresses)Adds recipients every other recipient can see were copied.
bcc
public Mail.Builder bcc(String... addresses)Adds recipients no other recipient is told about.
subject
public Mail.Builder subject(String subject)The subject line; any language, one line.
text
public Mail.Builder text(String text)The plain text body.
html
public Mail.Builder html(String html)The HTML body.
template
public Mail.Builder template(String view, Model model)The HTML body, rendered from the template
templates/<view>.html with model when the mail is sent. The
text body is derived from what was rendered, unless text gave
one.attach
public Mail.Builder attach(String name, String type, byte[] data)Attaches a file.
name: the file name the reader seestype: its media type, such asapplication/pdf; null forapplication/octet-streamdata: its content, which the mail keeps and does not copy
inline
public Mail.Builder inline(String contentId, String type, byte[] data)Embeds an image the HTML body shows with
<img src="cid:contentId">.header
public Mail.Builder header(String name, String value)Adds a header of the application’s own, such as
List-Unsubscribe
or X-Campaign. The headers a mail is built from – the addresses,
the subject, the date, the content headers – cannot be set here.build
public Mail build()Checks everything and answers the mail, or throws
IllegalArgumentException naming what is wrong.