You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Get your Postmark account and server tokens here](https://account.postmarkapp.com/api_tokens)
30
+
31
+
Create an `.env` file, and populate it with:
32
+
```bash
33
+
POSTMARK_SERVER_TOKEN={PostmarkServerToken}
34
+
POSTMARK_ACCOUNT_TOKEN={PostmarkAccountToken}
35
+
POSTMARK_SENDER_EMAIL=test@example.com
36
+
POSTMARK_TEST_MODE=false
37
+
POSTMARK_TRACK_OPENS=true
38
+
POSTMARK_LOG_LEVEL=1
39
+
```
40
+
41
+
## Running examples:
42
+
- Get messages example: `$ poetry run python examples/get_messages.py`
43
+
- Send messages example: `$ poetry run python examples/send_messages.py`
44
+
45
+
46
+
## Developing
47
+
48
+
### Running Tests
49
+
50
+
```bash
51
+
# Run all tests
52
+
poetry run pytest
53
+
54
+
# Run with coverage report
55
+
poetry run pytest --cov=postmark --cov-report=term-missing
56
+
57
+
# Run specific test file
58
+
poetry run pytest postmark/tests/test_messages.py
59
+
60
+
# Run with verbose output
61
+
poetry run pytest -v
62
+
63
+
# See HTML coverage report
64
+
poetry run pytest --cov=postmark --cov-report=html
65
+
open htmlcov/index.html
66
+
```
15
67
16
68
## Quick Start
17
69
@@ -31,7 +83,7 @@ async def get_messages():
31
83
32
84
print(f"Found {total} messages")
33
85
for msg in messages[:5]:
34
-
print(f" - {msg.subject} (from: {msg.from_})")
86
+
print(f" - {msg.subject} (from: {msg.sender})")
35
87
36
88
asyncio.run(get_messages())
37
89
```
@@ -40,11 +92,7 @@ asyncio.run(get_messages())
40
92
41
93
The SDK requires a Postmark Server Token for API authentication. You can find your token in the [Postmark dashboard](https://account.postmarkapp.com/servers).
42
94
43
-
```python
44
-
server_token ="your-postmark-server-token"
45
-
```
46
-
47
-
For security, we recommend storing your token in environment variables:
95
+
We recommend using environment variables:
48
96
49
97
```python
50
98
import os
@@ -79,7 +127,7 @@ async def send_email():
79
127
80
128
# Method 2: Using the Email model (Recommended for type safety)
0 commit comments