-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#411: expose validation sub steps in the MailerHelper class for the c…
…ompleteness check, CRLF inject scans and address validations
- Loading branch information
Showing
5 changed files
with
121 additions
and
35 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...s/simple-java-mail/src/main/java/org/simplejavamail/mailer/MailCompletenessException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.simplejavamail.mailer; | ||
|
||
import org.simplejavamail.MailException; | ||
|
||
public class MailCompletenessException extends MailValidationException { | ||
|
||
static final String MISSING_SENDER = "Email is not valid: missing sender. Provide with emailBuilder.from(...)"; | ||
static final String MISSING_RECIPIENT = "Email is not valid: missing recipients"; | ||
static final String MISSING_DISPOSITIONNOTIFICATIONTO = "Email is not valid: it is set to use \"Disposition Notification To\", but the address is empty"; | ||
static final String MISSING_RETURNRECEIPTTO = "Email is not valid: it is set to use \"Return Receipt To\", but the address is empty"; | ||
static final String INJECTION_SUSPECTED = "Suspected of injection attack, field: %s with suspicious value: %s"; | ||
|
||
|
||
MailCompletenessException(final String message) { | ||
super(message); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...simple-java-mail/src/main/java/org/simplejavamail/mailer/MailInvalidAddressException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.simplejavamail.mailer; | ||
|
||
public class MailInvalidAddressException extends MailValidationException { | ||
|
||
static final String INVALID_RECIPIENT = "Invalid TO address: %s"; | ||
static final String INVALID_REPLYTO = "Invalid REPLY TO address: %s"; | ||
static final String INVALID_BOUNCETO = "Invalid BOUNCE TO address: %s"; | ||
static final String INVALID_SENDER = "Invalid FROM address: %s"; | ||
static final String INVALID_DISPOSITIONNOTIFICATIONTO = "Invalid \"Disposition Notification To\" address: %s"; | ||
static final String INVALID_RETURNRECEIPTTO = "Invalid \"Return Receipt To\" address: %s"; | ||
|
||
|
||
MailInvalidAddressException(final String message) { | ||
super(message); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...e-java-mail/src/main/java/org/simplejavamail/mailer/MailSuspiciousCRLFValueException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.simplejavamail.mailer; | ||
|
||
public class MailSuspiciousCRLFValueException extends MailValidationException { | ||
|
||
static final String INJECTION_SUSPECTED = "Suspected of injection attack, field: %s with suspicious value: %s"; | ||
|
||
|
||
MailSuspiciousCRLFValueException(final String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters