Skip to content

Commit 6978f67

Browse files
committed
Add documentation about required value
1 parent 49870be commit 6978f67

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

docs/src/main/asciidoc/mailer-reference.adoc

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ To send a simple email, proceed as follows:
6666
[source, java]
6767
----
6868
// Imperative API:
69-
mailer.send(Mail.withText("[email protected]", "A simple email from quarkus", "This is my body."));
69+
mailer.send(Mail.withText("[email protected]", "A simple email from quarkus", "This is my body.").setFrom("[email protected]"));
7070
// Reactive API:
71-
Uni<Void> stage = reactiveMailer.send(Mail.withText("[email protected]", "A reactive email from quarkus", "This is my body."));
71+
Uni<Void> stage = reactiveMailer.send(Mail.withText("[email protected]", "A reactive email from quarkus", "This is my body.").setFrom("[email protected]"));
7272
----
7373

7474
For example, you can use the `Mailer` in an HTTP endpoint as follows:
@@ -78,14 +78,14 @@ For example, you can use the `Mailer` in an HTTP endpoint as follows:
7878
@GET
7979
@Path("/imperative")
8080
public void sendASimpleEmail() {
81-
mailer.send(Mail.withText("[email protected]", "A simple email from quarkus", "This is my body"));
81+
mailer.send(Mail.withText("[email protected]", "A simple email from quarkus", "This is my body").setFrom("[email protected]"));
8282
}
8383
8484
@GET
8585
@Path("/reactive")
8686
public Uni<Void> sendASimpleEmailAsync() {
8787
return reactiveMailer.send(
88-
Mail.withText("[email protected]", "A reactive email from quarkus", "This is my body"));
88+
Mail.withText("[email protected]", "A reactive email from quarkus", "This is my body").setFrom("[email protected]"));
8989
}
9090
----
9191

@@ -96,6 +96,20 @@ You can create new `io.quarkus.mailer.Mail` instances from the constructor or fr
9696
`Mail.withHtml` helper methods.
9797
The `Mail` instance lets you add recipients (to, cc, or bcc), set the subject, headers, sender (from) address...
9898

99+
Most of these properties are optional, but the sender address is required. It can either be set on an individual `Mail` instances using
100+
101+
[source,java]
102+
----
103+
.setFrom("[email protected]");
104+
----
105+
106+
or a global default can be configured, using
107+
108+
[source,properties]
109+
----
110+
111+
----
112+
99113
You can also send several `Mail` objects in one call:
100114

101115
[source, java]

0 commit comments

Comments
 (0)