Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Attachments option in SMTP binding. It will allow send mail attachments #1062

Open
geffzhang opened this issue Aug 9, 2021 · 15 comments
Labels
good first issue Good for newcomers kind/enhancement New feature or request pinned Issue does not get stale

Comments

@geffzhang
Copy link

Describe the feature

Add Attachments option in SMTP binding. It will allow send mail attachments

RELEASE NOTE:

@geffzhang geffzhang added the kind/enhancement New feature or request label Aug 9, 2021
@dapr-bot
Copy link
Collaborator

dapr-bot commented Sep 8, 2021

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@dapr-bot dapr-bot added the stale label Sep 8, 2021
@dapr-bot
Copy link
Collaborator

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

@yaron2 yaron2 reopened this Oct 25, 2021
@yaron2 yaron2 added the good first issue Good for newcomers label Oct 25, 2021
@yaron2
Copy link
Member

yaron2 commented Oct 25, 2021

Reopened this.

@rovangju
Copy link

Came across a need for this recently. Is there any guidance on how this should look for the API?

@yaron2
Copy link
Member

yaron2 commented Oct 18, 2022

Came across a need for this recently. Is there any guidance on how this should look for the API?

As an output binding, the attachment can use the data property on the payload. The binding will then check if the request.Data property is not nil, and then use that as the attachment.

@yaron2 yaron2 added this to the v1.10 milestone Dec 14, 2022
@robertojrojas
Copy link
Contributor

/assign

@robertojrojas
Copy link
Contributor

It appears that the request.Data is already being used for the body of the email.

I wonder if it makes sense to do the following instead:

  • If the contents of the request.Data is preferred to be placed as an attachment instead of being added to the body, we could add another metadata property, say something like bodyAsAttachment. The SMTP binding code can use this property as a flag to decide if it places the request.Data as the email attachment or if missing place it in the body of the email (as it currently does).
  • If the attachment flag (bodyAsAttachment) is set, the body could be a simple text like "See attachment" or the like.
  • A limit to the size of the attachment can be applied, say 10MB-20MB, can be set to avoid rejection of the email by the SMTP servers.

@yaron2
Copy link
Member

yaron2 commented Dec 16, 2022

If the contents of the request.Data is preferred to be placed as an attachment instead of being added to the body, we could add another metadata property, say something like bodyAsAttachment. The SMTP binding code can use this property as a flag to decide if it places the request.Data as the email attachment or if missing place it in the body of the email (as it currently does).

This makes sense. No need to add a "See attachment" to the body in the case of attachment.

@robertojrojas
Copy link
Contributor

Came across a need for this recently. Is there any guidance on how this should look for the API?

@rovangju Could you please share the specifics on the need for attachments? It'll help me have a better idea how folks are thinking about using this feature.

@rovangju
Copy link

Nothing special; simple things like generated results from a job (pdf, csv, etc).
One thing I was wondering was if there was a way to detect if the data was multipart. Then you could use existing builders to craft whatever payloads you want (e.g.: embedded logo images, etc).

@robertojrojas
Copy link
Contributor

The topic of multipart is a great point! Let's look into that.

@berndverst
Copy link
Member

berndverst commented Feb 1, 2023

@robertojrojas
If the body is multipart we should pass it through as is (not sure if our library supports defining the raw message like that). Can use this to detect: https://pkg.go.dev/mime/multipart should be good for trying to parse the body as multipart.

But for users who want more convenience and do not know how to craft multipart encodings.. I think we should support some sort of option like this (JSON):

{
  "body": "sometext",
  "attachments": [
    {
      "content-type": "bla",
      "filename": "stuff",
      "data": "b64 encoded file contents"
    },
    // more attachments here
  ]
}

@berndverst berndverst modified the milestones: v1.10, v1.11 Feb 1, 2023
@berndverst berndverst modified the milestones: v1.11, v1.12 May 26, 2023
@artursouza artursouza added pinned Issue does not get stale and removed stale labels Jun 30, 2023
@artursouza artursouza removed this from the v1.12 milestone Jun 30, 2023
@KrzysztofPajak
Copy link

Hello,
@artursouza Is there any estimated time that feature will be available?

@libreo-abrettschneider
Copy link

We also need to send attachments via mail. Cause this feature is missing we have to implement smtp in the app itself which is what dapr is trying to avoid. In our case we need to send reports as attachments. Still no solution for that I assume?

@BC89
Copy link

BC89 commented Nov 8, 2024

Would like to see this feature as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/enhancement New feature or request pinned Issue does not get stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants