Implement validation for RFC 5536 mandatory headers
This commit is contained in:
parent
cd1a690bc1
commit
8edd5967a0
1 changed files with 19 additions and 0 deletions
|
@ -355,6 +355,25 @@ class Message(DatabaseTable):
|
|||
remote
|
||||
)
|
||||
|
||||
def validate(self):
|
||||
if self.created_on is None:
|
||||
return False
|
||||
|
||||
if self.sender is None:
|
||||
return False
|
||||
|
||||
if self.message_id is None:
|
||||
return False
|
||||
|
||||
if self.subject is None:
|
||||
return False
|
||||
|
||||
if self.header('Newsgroups') is None:
|
||||
return False
|
||||
|
||||
if self.header('Path') is None:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def from_text(text: str):
|
||||
message = Message()
|
||||
|
|
Loading…
Add table
Reference in a new issue