feat: file attachment support for sending emails#1965
Conversation
Co-authored-by: rnwood <1327895+rnwood@users.noreply.github.com>
Co-authored-by: rnwood <1327895+rnwood@users.noreply.github.com>
…aks, and reduce code duplication Co-authored-by: rnwood <1327895+rnwood@users.noreply.github.com>
Co-authored-by: rnwood <1327895+rnwood@users.noreply.github.com>
|
@copilot why does adding this param break the existing API contract? Can't we just add it optionally? |
The parameter is already optional with a default value of
All existing calls in the codebase (Reply, Send, TUI) work without modification because they omit the optional parameter. The implementation gracefully handles Commit: 310035d |
|
@copilot I am talking about the rest api |
The REST API is fully backward compatible. I created new separate endpoints rather than modifying existing ones: Original endpoints (unchanged):
New endpoints for attachments:
Existing API clients continue to work without any changes. The frontend automatically selects the appropriate endpoint based on whether attachments are present. Commit: 310035d |
|
But it adds another API action. Can't it just be an optional part of the existing? |
|
@copilot see above comment |
…ate sendWithAttachments/replyWithAttachments endpoints Co-authored-by: rnwood <1327895+rnwood@users.noreply.github.com>
Done! The existing endpoints now handle attachments optionally: Updated endpoints:
The endpoints automatically detect the content type:
The TypeScript client intelligently selects the appropriate content type based on whether attachments are provided. No new API actions were added - the separate Commit: c58f4bd |
|
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
|
📊 Code Coverage Report
📁 Coverage by Namespace
Overall Coverage Details:
Enhanced coverage report with namespace breakdown - Azure DevOps Build #3.11.0-ci20251206139_pr1965 20251206.40 |



This pull request adds support for sending email attachments when composing or replying to messages in the application. The changes span the frontend (Vue component and API client) and backend (controller and server) to handle file uploads, process attachments, and include them in outgoing emails. It also introduces validation for attachment size and ensures compatibility with both HTML and multipart/form-data requests.
Frontend changes:
Attachment UI and Handling:
messagecompose.vuecomponent using Element Plus'sel-upload, allowing users to select multiple files when composing or replying to messages. [1] [2]API Client Updates:
MessagesControllerTypeScript client to support sending attachments. Thesendandreplymethods now detect if attachments are present and usemultipart/form-datafor requests; otherwise, they default totext/html.Backend changes:
Controller Enhancements:
MessagesController.csbackend now accepts bothtext/htmlandmultipart/form-datafor thesendandreplyendpoints. Attachments are processed and validated (with a 10MB per-file limit) before being passed to the mail server. [1] [2] [3] [4]Attachment Processing and Server Integration:
AttachmentInfoclass to encapsulate attachment metadata and content. The server'sSendmethod and interface were updated to accept attachments and include them in outgoing emails. [1] [2] [3] [4]Summary of most important changes:
Frontend:
messagecompose.vue, and ensured attachments are included in send/reply actions. [1] [2] [3] [4]MessagesController.tsto support sending attachments viamultipart/form-datawhen present.Backend:
MessagesController.csto accept and process attachments for thesendandreplyendpoints, with validation and support for both content types. [1] [2] [3] [4]AttachmentInfoclass and updated the SMTP server interface and implementation to handle attachments in outgoing emails. [1] [2] [3] [4]