Permalink
Browse files

canonize inability to send messages without one direct recipient

  • Loading branch information...
1 parent d2c6adf commit 95ff3e71a34dbbee919b2939620a54733a40648e @mcdonc mcdonc committed Mar 20, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 pyramid_mailer/message.py
@@ -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")

0 comments on commit 95ff3e7

Please sign in to comment.