diff --git a/CHANGELOG.md b/CHANGELOG.md index 41aa8d8..a26d56f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ nylas-python Changelog Unreleased ---------------- +* Add support for from field for sending messages * Fix IMAP identifiers not encoding correctly * Add missing schedule-specific fields to Message model diff --git a/nylas/models/drafts.py b/nylas/models/drafts.py index 3f77aae..f77a125 100644 --- a/nylas/models/drafts.py +++ b/nylas/models/drafts.py @@ -164,7 +164,9 @@ class SendMessageRequest(CreateDraftRequest): reply_to_message_id (NotRequired[str]): The ID of the message that you are replying to. tracking_options (NotRequired[TrackingOptions]): Options for tracking opens, links, and thread replies. custom_headers(NotRequired[List[CustomHeader]]): Custom headers to add to the message. + from_: The sender of the message. use_draft: Whether or not to use draft support. This is primarily used when dealing with large attachments. """ + from_: NotRequired[List[EmailName]] use_draft: NotRequired[bool] diff --git a/nylas/resources/messages.py b/nylas/resources/messages.py index 7687335..310f368 100644 --- a/nylas/resources/messages.py +++ b/nylas/resources/messages.py @@ -169,6 +169,9 @@ def send( form_data = None json_body = None + # From is a reserved keyword in Python, so we need to pull the data from 'from_' instead + request_body["from"] = request_body.get("from_", None) + # Use form data only if the attachment size is greater than 3mb attachment_size = sum( attachment.get("size", 0)