Coverage for mindsdb / integrations / handlers / email_handler / settings.py: 0%

22 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-21 00:36 +0000

1import datetime 

2from pydantic import BaseModel 

3 

4 

5class EmailSearchOptions(BaseModel): 

6 """ 

7 Represents IMAP search options to use when searching emails 

8 """ 

9 # IMAP mailbox to search. 

10 mailbox: str = "INBOX" 

11 # Search by email subject. 

12 subject: str = None 

13 # Search based on who the email was sent to. 

14 to_field: str = None 

15 # Search based on who the email was from. 

16 from_field: str = None 

17 # Search based on when the email was received. 

18 since_date: datetime.date = None 

19 until_date: datetime.date = None 

20 # Search for all emails after this ID. 

21 since_email_id: int = None 

22 

23 class Config: 

24 json_schema_extra = { 

25 "example": { 

26 "mailbox": "INBOX", 

27 "subject": "Test", 

28 "to_email": "example@example.com", 

29 "from_email": "hello@example.com", 

30 "since_date": "2021-01-01", 

31 "until_date": "2021-01-31", 

32 "since_email_id": "123" 

33 } 

34 

35 } 

36 extra = "forbid" 

37 

38 

39class EmailConnectionDetails(BaseModel): 

40 """ 

41 Represents the connection details for an email client 

42 """ 

43 email: str 

44 password: str 

45 imap_server: str = "imap.gmail.com" 

46 smtp_server: str = "smtp.gmail.com" 

47 smtp_port: int = 587 

48 

49 class Config: 

50 json_schema_extra = { 

51 "example": { 

52 "email": "joe@bloggs.com", 

53 "password": "password", 

54 "imap_server": "imap.gmail.com", 

55 "smtp_server": "smtp.gmail.com", 

56 "smtp_port": 587 

57 } 

58 } 

59 extra = "forbid"