12-single_mail.php 624 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace cx_newsletter;
  3. use \Exception;
  4. class single_mail {
  5. public string $title = '';
  6. public string $content = '';
  7. public array $headers = [];
  8. public bool $is_html = false;
  9. public ?string $to = null;
  10. public ?string $reply_to = null;
  11. public function is_good() : bool {
  12. return $this->validate() === null;
  13. }
  14. public function validate() : ?string {
  15. if ($this->reply_to === null) {
  16. return 'Reply to is not set in email.';
  17. }
  18. if ($this->to === null) {
  19. return 'Target email is not set.';
  20. }
  21. return null;
  22. }
  23. }