Sendgrid-nodejs: Attach files to email from S3

Created on 16 Oct 2017  路  7Comments  路  Source: sendgrid/sendgrid-nodejs

This should be added to the Mail helper method, where the file that is attached can be sitting on an S3 bucket.

In most circumstances, for Spam detection reasons, it would be better to link to the file- however, there are legitimate use cases for attaching a file. Example: Receipt PDFs

medium work in progress sendgrid enhancement

All 7 comments

Hey @thinkingserious , I would like to take up this issue. Can you please guide me about where to start looking?

Hi @techpool!

Thanks for offering to help out, we greatly appreciate it!

I believe this helper could be implemented as it's own package here. Perhaps with the name attachments. That way we could put all helper code for additional attachment functionality there (for example, base64 auto-encoding), especially if it requires additional dependencies.

With Best Regards,

Elmer

@adamreisnz,

What do you think?

Agreed, a separate package seems best. But we'd have to see how the two packages would integrate with one another and how this would work.

I don't think the current V3 API supports passing in a key to an S3 bucket object. So would we need to download the file from S3 first and then send it along with the mail request? Or can the Sendgrid API somehow interact with S3 objects?

I don't think Sendgrid has the functionality to interact directly with S3 object, the objects probably first needs to be downloaded and then sent as attachments.

In that case I'm not sure if we should integrate this functionality with the mail helper. There is already the well maintained aws-sdk package which does all that for you.

If we want to manage all this for the user, we have to pull in a lot of dependencies and deal with S3 credentials etc. I don't know if it's worth the hassle.

@thinkingserious you raised this issue, do the other libraries support this? If so, how do you deal with credentials handling etc?

Node is very package oriented, and if you're already dealing with S3 (to upload files) chances are you are already using the AWS SDK and have your own implementation going. If the mail client will have to download the files first, it will add significant overhead and a lot of things could go wrong.

So my preference would be to not deal with this, focus one one thing and do it well (e.g. sending mail, not dealing with S3)

@adamreisnz @thinkingserious would it make sense instead to provide this an as an example Use Case, that points users to the aws-sdk?

@mbernier yeah I personally think it would, there's no point in reinventing the wheel

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amlcodes picture amlcodes  路  4Comments

egges picture egges  路  3Comments

thinkingserious picture thinkingserious  路  4Comments

kiranshashiny picture kiranshashiny  路  4Comments

thidasapankaja picture thidasapankaja  路  4Comments