Skip to content

Conversation

@AaronDDM
Copy link
Collaborator

@AaronDDM AaronDDM commented Aug 28, 2025

What did you do?

  • Added support for is_plaintext for POST /send and POST /drafts endpoints.
  • Fixed the CHANGELOG.md, we forgot to add 7.12.0 and kept it as Unreleased

License

I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@playerzero-ai
Copy link

playerzero-ai bot commented Aug 28, 2025

Pull Request Summary

The pull request introduces several enhancements and new features related to email message and draft handling, focusing on the support for plaintext email formats. Key changes include:

  • Plaintext Email Support:

    • Added the ability to send emails and create drafts in plaintext format, alongside existing HTML options.
    • Introduced a new isPlaintext parameter across various functions to specify the email body format.
    • Updated email body generation logic to conditionally use plaintext or HTML based on the isPlaintext parameter.
  • Functionality Enhancements:

    • New function demonstratePlaintextMessageSending to showcase sending plaintext emails.
    • Enhanced attachment sending functions (sendFilePathAttachments, sendStreamAttachments, sendBufferAttachments, sendStringAttachments, sendAttachmentsByFormat) to support plaintext options.
    • CLI updated with a --plaintext option for users to opt into sending plaintext emails.
  • Drafts Handling:

    • Added isPlaintext property to CreateDraftRequest to specify email format during draft creation.
    • Ensured drafts cannot be updated to change their format from HTML to plaintext or vice versa.
  • Testing Improvements:

    • Added test cases to validate the inclusion and handling of the isPlaintext flag in both message sending and draft creation processes.
  • User Experience:

    • Enhanced flexibility and control over email content format, allowing users to choose between plaintext and HTML.
    • Improved console output to inform users about the email format being used.

These changes collectively aim to provide users with more control over email formatting, improve the robustness of email handling, and ensure consistent behavior across different email sending scenarios.

Files Changed

File Name Summary
examples/messages/messages.ts Added demonstratePlaintextMessageSending to send plaintext-only emails; updated main to call it.
examples/messages/examples/index.ts Updated SendAttachmentsExamples type with detailed params and optional isPlaintext for attachment functions.
src/models/drafts.ts Added isPlaintext to CreateDraftRequest; removed it from UpdateDraftRequest to fix format on creation only.
examples/messages/examples/string-attachments.ts Added isPlaintext param to sendStringAttachments; email body and request updated to support plaintext or HTML.
examples/messages/examples/flexible-attachments.ts Added isPlaintext param to sendAttachmentsByFormat; email body and request updated accordingly.
examples/messages/cli-interface.ts Added --plaintext CLI option and isPlaintext flag; updated commands and output to support plaintext sending.
tests/resources/messages.spec.ts Added tests verifying isPlaintext flag handling in JSON and multipart send requests.
examples/messages/examples/stream-attachments.ts Added isPlaintext param to sendStreamAttachments; conditional plaintext/HTML email body logic added.
examples/messages/examples/buffer-attachments.ts Added isPlaintext param to sendBufferAttachments; updated email body and request to support plaintext.
tests/resources/drafts.spec.ts Added tests for creating drafts with isPlaintext true, including large attachment multipart cases.
examples/messages/examples/file-path-attachments.ts Added isPlaintext param to sendFilePathAttachments; email body generation updated for plaintext option.

View more in PlayerZero
updated: Aug 28 @ 03:25 PM UTC

@codecov
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.87%. Comparing base (7fe13ff) to head (3d409ce).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #661   +/-   ##
=======================================
  Coverage   94.87%   94.87%           
=======================================
  Files          35       35           
  Lines         781      781           
  Branches       66       66           
=======================================
  Hits          741      741           
  Misses         33       33           
  Partials        7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AaronDDM AaronDDM force-pushed the TW-4152-add-is-plaintext-support branch from 2becb56 to 1135792 Compare August 28, 2025 15:14
@AaronDDM AaronDDM marked this pull request as ready for review August 28, 2025 15:14
@AaronDDM AaronDDM merged commit df928dc into main Aug 28, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants