validate method

void validate()

Validate that required fields are present

Implementation

void validate() {
  if (to.isEmpty) {
    throw MailValidationError('At least one recipient is required in "to"');
  }
  if (subject.isEmpty) {
    throw MailValidationError('Subject cannot be empty');
  }
}