Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions resend/emails/_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class _EmailDefaultAttrs(_FromParam):
"""
The Email ID.
"""
message_id: str
"""
RFC Message-ID header value for the email.
"""
to: Union[List[str], str]
"""
List of email addresses to send the email to.
Expand Down Expand Up @@ -60,6 +64,7 @@ class Email(_EmailDefaultAttrs):

Attributes:
id (str): The Email ID.
message_id (str): RFC Message-ID header value for the email.
from (str): The email address the email was sent from.
to (Union[List[str], str]): List of email addresses to send the email to.
created_at (str): When the email was created.
Expand Down
5 changes: 5 additions & 0 deletions tests/emails_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def test_email_get(self) -> None:
{
"object": "email",
"id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c",
"message_id": "<111-222-333@email.example.com>",
"to": ["james@bond.com"],
"from": "onboarding@resend.dev",
"created_at": "2023-04-03T22:13:42.674981+00:00",
Expand All @@ -58,6 +59,7 @@ def test_email_get(self) -> None:
email_id="4ef9a417-02e9-4d39-ad75-9611e0fcc33c",
)
assert email["id"] == "4ef9a417-02e9-4d39-ad75-9611e0fcc33c"
assert email["message_id"] == "<111-222-333@email.example.com>"

def test_should_get_email_raise_exception_when_no_content(self) -> None:
self.set_mock_json(None)
Expand Down Expand Up @@ -165,6 +167,7 @@ def test_email_list(self) -> None:
"data": [
{
"id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c",
"message_id": "<111-222-333@email.example.com>",
"to": ["james@bond.com"],
"from": "onboarding@resend.dev",
"created_at": "2023-04-03T22:13:42.674981+00:00",
Expand All @@ -178,6 +181,7 @@ def test_email_list(self) -> None:
},
{
"id": "5ef9a417-02e9-4d39-ad75-9611e0fcc33d",
"message_id": "<222-333-444@email.example.com>",
"to": ["test@example.com"],
"from": "hello@resend.dev",
"created_at": "2023-04-04T10:15:42.674981+00:00",
Expand All @@ -199,6 +203,7 @@ def test_email_list(self) -> None:
assert len(emails["data"]) == 2
assert emails["has_more"] == True
assert emails["data"][0]["id"] == "4ef9a417-02e9-4d39-ad75-9611e0fcc33c"
assert emails["data"][0]["message_id"] == "<111-222-333@email.example.com>"
assert emails["data"][1]["id"] == "5ef9a417-02e9-4d39-ad75-9611e0fcc33d"

def test_email_list_with_params(self) -> None:
Expand Down
Loading