Skip to content

Commit

Permalink
canonize inability to send messages without one direct recipient
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Mar 20, 2012
1 parent d2c6adf commit 95ff3e7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyramid_mailer/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ def validate(self):
if not (self.recipients or self.cc or self.bcc):
raise InvalidMessage("No recipients have been added")

if (self.cc or self.bcc) and not self.recipients:
raise InvalidMessage("Must have at least one direct recipient "
"even if cc or bcc set")

if not self.body and not self.html:
raise InvalidMessage("No body has been set")

Expand Down

0 comments on commit 95ff3e7

Please sign in to comment.