@@ -86,7 +86,11 @@ public static boolean validateLenient(@NotNull final Email email)
8686 public static boolean validateLenient (@ NotNull final Email email , @ Nullable final EmailValidator emailValidator )
8787 throws MailException {
8888 LOGGER .debug ("validating email..." );
89- MailerHelper .validateCompleteness (email );
89+ try {
90+ MailerHelper .validateCompleteness (email );
91+ } catch (MailCompletenessException e ) {
92+ LOGGER .warn ("encountered (and ignored) missing field: {}" , e .getMessage ());
93+ }
9094 try {
9195 MailerHelper .validateAddresses (email , emailValidator );
9296 } catch (MailInvalidAddressException e ) {
@@ -194,8 +198,10 @@ public static void scanForInjectionAttacks(final @NotNull Email email) {
194198 scanForInjectionAttack (embeddedImage .getDataSource ().getName (), "email.embeddedImage.datasource.name" );
195199 scanForInjectionAttack (embeddedImage .getDescription (), "email.embeddedImage.description" );
196200 }
197- scanForInjectionAttack (email .getFromRecipient ().getName (), "email.fromRecipient.name" );
198- scanForInjectionAttack (email .getFromRecipient ().getAddress (), "email.fromRecipient.address" );
201+ if (!valueNullOrEmpty (email .getFromRecipient ())) {
202+ scanForInjectionAttack (email .getFromRecipient ().getName (), "email.fromRecipient.name" );
203+ scanForInjectionAttack (email .getFromRecipient ().getAddress (), "email.fromRecipient.address" );
204+ }
199205 if (!valueNullOrEmpty (email .getReplyToRecipient ())) {
200206 scanForInjectionAttack (email .getReplyToRecipient ().getName (), "email.replyToRecipient.name" );
201207 scanForInjectionAttack (email .getReplyToRecipient ().getAddress (), "email.replyToRecipient.address" );
0 commit comments