Skip to content

Commit 0f9682d

Browse files
feat(api): improve raw MIME error handling
1 parent 62ea195 commit 0f9682d

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 32
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/ark%2Fark-e3ff3c6b072d4d238c3a65297b743136d16ab74ca841c8931a9606a7cb7f1e02.yml
3-
openapi_spec_hash: 99861f96d1cc6aa31dfe3a2460adf46b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/ark%2Fark-c7a958bca7912840fb91bf86ed7f4b6c292afd8d0a1a7f1091f9b067be87f786.yml
3+
openapi_spec_hash: d64cce1d9d6d329cf8a870b20c3aed62
44
config_hash: d547cc5e7cc41bda64fd8db0d7cb1279

src/ark/resources/emails.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,9 @@ def send_raw(
499499
Use this for advanced use cases or
500500
when migrating from systems that generate raw email content.
501501
502-
The `rawMessage` field should contain the base64-encoded raw email.
502+
**Important:** The `rawMessage` field must be base64-encoded. Your raw MIME
503+
message (with headers like From, To, Subject, Content-Type, followed by a blank
504+
line and the body) must be encoded to base64 before sending.
503505
504506
Args:
505507
from_: Sender email address. Must be from a verified domain.
@@ -512,7 +514,11 @@ def send_raw(
512514
513515
The domain portion must match a verified sending domain in your account.
514516
515-
raw_message: Base64-encoded RFC 2822 MIME message
517+
raw_message: Base64-encoded RFC 2822 MIME message.
518+
519+
**You must base64-encode your raw email before sending.** The raw email should
520+
include headers (From, To, Subject, Content-Type, etc.) followed by a blank line
521+
and the message body.
516522
517523
to: Recipient email addresses
518524
@@ -1006,7 +1012,9 @@ async def send_raw(
10061012
Use this for advanced use cases or
10071013
when migrating from systems that generate raw email content.
10081014
1009-
The `rawMessage` field should contain the base64-encoded raw email.
1015+
**Important:** The `rawMessage` field must be base64-encoded. Your raw MIME
1016+
message (with headers like From, To, Subject, Content-Type, followed by a blank
1017+
line and the body) must be encoded to base64 before sending.
10101018
10111019
Args:
10121020
from_: Sender email address. Must be from a verified domain.
@@ -1019,7 +1027,11 @@ async def send_raw(
10191027
10201028
The domain portion must match a verified sending domain in your account.
10211029
1022-
raw_message: Base64-encoded RFC 2822 MIME message
1030+
raw_message: Base64-encoded RFC 2822 MIME message.
1031+
1032+
**You must base64-encode your raw email before sending.** The raw email should
1033+
include headers (From, To, Subject, Content-Type, etc.) followed by a blank line
1034+
and the message body.
10231035
10241036
to: Recipient email addresses
10251037

src/ark/types/email_send_raw_params.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ class EmailSendRawParams(TypedDict, total=False):
2525
"""
2626

2727
raw_message: Required[Annotated[str, PropertyInfo(alias="rawMessage")]]
28-
"""Base64-encoded RFC 2822 MIME message"""
28+
"""Base64-encoded RFC 2822 MIME message.
29+
30+
**You must base64-encode your raw email before sending.** The raw email should
31+
include headers (From, To, Subject, Content-Type, etc.) followed by a blank line
32+
and the message body.
33+
"""
2934

3035
to: Required[SequenceNotStr[str]]
3136
"""Recipient email addresses"""

0 commit comments

Comments
 (0)