@@ -225,7 +225,7 @@ public Email buildEmail() {
225
225
* <p>
226
226
* The id-format should be conform <a href="https://tools.ietf.org/html/rfc5322#section-3.6.4">rfc5322#section-3.6.4</a>
227
227
*/
228
- public EmailPopulatingBuilder fixingMessageId (@ Nonnull final String id ) {
228
+ public EmailPopulatingBuilder fixingMessageId (@ Nullable final String id ) {
229
229
this .id = id ;
230
230
return this ;
231
231
}
@@ -279,11 +279,10 @@ public EmailPopulatingBuilder from(@Nonnull final Recipient recipient) {
279
279
}
280
280
281
281
/**
282
- * Delegates to {@link #withReplyTo(Recipient)} with a new {@link Recipient} wrapped around the given email address.
282
+ * Delegates to {@link #withReplyTo(Recipient)} with a new {@link Recipient} wrapped around the given email address (or null if missing) .
283
283
*/
284
- public EmailPopulatingBuilder withReplyTo (@ Nonnull final String replyToAddress ) {
285
- checkNonEmptyArgument (replyToAddress , "replyToAddress" );
286
- return withReplyTo (new Recipient (null , replyToAddress , null ));
284
+ public EmailPopulatingBuilder withReplyTo (@ Nullable final String replyToAddress ) {
285
+ return withReplyTo (replyToAddress != null ? new Recipient (null , replyToAddress , null ) : null );
287
286
}
288
287
289
288
/**
@@ -319,17 +318,16 @@ public EmailPopulatingBuilder withReplyTo(@Nullable final String fixedName, @Non
319
318
*
320
319
* @see #withReplyTo(String, String)
321
320
*/
322
- public EmailPopulatingBuilder withReplyTo (@ Nonnull final Recipient recipient ) {
323
- checkNonEmptyArgument (recipient , "replyToRecipient" );
324
- this .replyToRecipient = new Recipient (recipient .getName (), recipient .getAddress (), null );
321
+ public EmailPopulatingBuilder withReplyTo (@ Nullable final Recipient recipient ) {
322
+ this .replyToRecipient = recipient != null ? new Recipient (recipient .getName (), recipient .getAddress (), null ) : null ;
325
323
return this ;
326
324
}
327
325
328
326
/**
329
- * Delegates to {@link #withBounceTo(Recipient)} with a new {@link Recipient} wrapped around the email address.
327
+ * Delegates to {@link #withBounceTo(Recipient)} with a new {@link Recipient} wrapped around the email address (or null if missing) .
330
328
*/
331
- public EmailPopulatingBuilder withBounceTo (@ Nonnull final String bounceToAddress ) {
332
- return withBounceTo (new Recipient (null , checkNonEmptyArgument ( bounceToAddress , "bounceToAddress" ), null ) );
329
+ public EmailPopulatingBuilder withBounceTo (@ Nullable final String bounceToAddress ) {
330
+ return withBounceTo (bounceToAddress != null ? new Recipient (null , bounceToAddress , null ) : null );
333
331
}
334
332
335
333
/**
@@ -365,24 +363,23 @@ public EmailPopulatingBuilder withBounceTo(@Nullable final String name, @Nonnull
365
363
*
366
364
* @see #withBounceTo(String, String)
367
365
*/
368
- public EmailPopulatingBuilder withBounceTo (@ Nonnull final Recipient recipient ) {
369
- checkNonEmptyArgument (recipient , "bounceToRecipient" );
370
- this .bounceToRecipient = new Recipient (recipient .getName (), recipient .getAddress (), null );
366
+ public EmailPopulatingBuilder withBounceTo (@ Nullable final Recipient recipient ) {
367
+ this .bounceToRecipient = recipient != null ? new Recipient (recipient .getName (), recipient .getAddress (), null ) : null ;
371
368
return this ;
372
369
}
373
370
374
371
/**
375
- * Sets the subject of this email.
372
+ * Sets the optional subject of this email.
376
373
*/
377
- public EmailPopulatingBuilder withSubject (@ Nonnull final String subject ) {
378
- this .subject = checkNonEmptyArgument ( subject , "subject" ) ;
374
+ public EmailPopulatingBuilder withSubject (@ Nullable final String subject ) {
375
+ this .subject = subject ;
379
376
return this ;
380
377
}
381
378
382
379
/**
383
380
* @see EmailBuilderInstance#forwarding(MimeMessage)
384
381
*/
385
- EmailPopulatingBuilder withForward (@ Nonnull final MimeMessage emailMessageToForward ) {
382
+ EmailPopulatingBuilder withForward (@ Nullable final MimeMessage emailMessageToForward ) {
386
383
this .emailToForward = emailMessageToForward ;
387
384
return this ;
388
385
}
0 commit comments