Skip to content

Feature Request: io.Reader as attachment #149

Open
wshaman wants to merge 1 commit intogo-gomail:v2from
wshaman:v2
Open

Feature Request: io.Reader as attachment #149
wshaman wants to merge 1 commit intogo-gomail:v2from
wshaman:v2

Conversation

@wshaman
Copy link

@wshaman wshaman commented Apr 1, 2020

Short: Add io.Reader as attachment
Motivation: Using any cloud file storage (s3 in my case) you have to

  1. read stream from storage
  2. save it to file on local disk
  3. add local file as attachment to mail (here gomail reads localfile as stream and converts to []byte)

We can reduce amount of conversions and keep code more straight-forward

@ahuret
Copy link

ahuret commented Nov 2, 2020

Nice idea, but I think it would be better to reuse the existing (appendFile) so that no dupplication here.

It means changing appendFile signature and filename would be an io.Reader (instead of string), and Attach( method would be responsible for converting filename string to io.Reader by opening the file.

What do you think ? :)

@mcbaloo
Copy link

mcbaloo commented Dec 8, 2020

@ahuret I have a file URL on a cloud server I want to attach to a mail. How do I implement this?

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