Skip to content

Commit

Permalink
#98: removed mandatory restriction from both subject and content
Browse files Browse the repository at this point in the history
  • Loading branch information
bbottema committed Aug 21, 2017
1 parent c455ce0 commit 2a31f47
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 1 addition & 5 deletions src/main/java/org/simplejavamail/mailer/Mailer.java
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,7 @@ public final synchronized void sendMail(final Email email, @SuppressWarnings("Sa
public boolean validate(final Email email)
throws MailException {
// check for mandatory values
if (email.getText() == null && email.getTextHTML() == null) {
throw new MailerException(MailerException.MISSING_CONTENT);
} else if (email.getSubject() == null || email.getSubject().equals("")) {
throw new MailerException(MailerException.MISSING_SUBJECT);
} else if (email.getRecipients().size() == 0) {
if (email.getRecipients().size() == 0) {
throw new MailerException(MailerException.MISSING_RECIPIENT);
} else if (email.getFromRecipient() == null) {
throw new MailerException(MailerException.MISSING_SENDER);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/simplejavamail/mailer/MailerException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class MailerException extends MailException {
static final String INVALID_RETURNRECEIPTTO = "Invalid \"Return Receipt To\" address: %s";
static final String MISSING_SENDER = "Email is not valid: missing sender";
static final String MISSING_RECIPIENT = "Email is not valid: missing recipients";
static final String MISSING_SUBJECT = "Email is not valid: missing subject";
static final String MISSING_CONTENT = "Email is not valid: missing content body";
static final String MISSING_DISPOSITIONNOTIFICATIONTO = "Email is not valid: missing \"Disposition Notification To\" address";
static final String MISSING_RETURNRECEIPTTO = "Email is not valid: missing \"Return Receipt To\" address";
static final String INJECTION_SUSPECTED = "Suspected of injection attack, field: %s with suspicious value: %s";
Expand Down

0 comments on commit 2a31f47

Please sign in to comment.