nodemailer-sendgrid-transport icon indicating copy to clipboard operation
nodemailer-sendgrid-transport copied to clipboard

(Nodemailer) Why isn't this supported anymore?

Open IonicaBizau opened this issue 8 years ago • 29 comments

Maybe can I adopt it? Or is there a specific reason for deprecation?

IonicaBizau avatar Nov 20 '16 14:11 IonicaBizau

It is not discounted completely, but our new v3 API was a complete change from the old API in form, function, structure, everything. So, it made sense to try something new within our libraries as well.

We are open to bringing this back if it's something we absolutely need to bring back, but so far our new library is working really well much fewer dependencies.

mbernier avatar Nov 21 '16 15:11 mbernier

I was looking at the nodemailer yesterday and what I liked about it is that it allows the same public interface, across multiple providers.

IonicaBizau avatar Nov 21 '16 16:11 IonicaBizau

That totally makes sense. One thing we were definitely doing in our rewrite was removing the constraints we had from other dependencies but there is definite up side to having the consistent interface.

What is your use case? Are you integrating with a 3rd party service that uses nodemailer or is it just that having the ability to switch providers easily is ideal? Something else?

Thank you!!!

mbernier avatar Nov 21 '16 16:11 mbernier

@mbernier Initially I wanted to build a general plugin for @Bloggify to send emails. But since I use SendGrid, I ended with creating bloggify-sendgrid.

Still, would be nice to solve this issue one day, so then we can have a general module for sending emails via nodemailer. :grin:

IonicaBizau avatar Nov 21 '16 16:11 IonicaBizau

I updated the title here and marked it as a question. I am interested to see what other people in the Node community think, because this is not the first request on this.

We want to support what you all NEED from us, in order to make your jobs easier.

It is totally possible for us to support nodemailer in a helper, as well as continue to support our own helpers. And we will do this, if we see that support for this feature is warranted and useful to our community.

To everyone else who's reading this - if you want nodemailer support in a helper - throw a thumbs up on this comment or on @IonicaBizau's original comment to let us know!!

mbernier avatar Nov 21 '16 18:11 mbernier

I agree! 👍

IonicaBizau avatar Nov 21 '16 18:11 IonicaBizau

So... what is the recommended library for sending e-mails in nodemailer using SendGrid? This is not very clear to me.

elboletaire avatar Nov 23 '16 12:11 elboletaire

@elboletaire We don't have a recommended nodemailer library currently.

We only officially support this Node.js library: https://github.com/sendgrid/sendgrid-nodejs

I hope that helps. Thanks!

thinkingserious avatar Nov 29 '16 02:11 thinkingserious

I also would like to see nodemailer continue to be supported. Not that I have any problem with the official node module, it's just that I think it's better to have a provider agnostic way to send email. I think that this kind of "openness" is better for Sendgrid as well. In fact, when I was first looking to send emails with node, I started using nodemailer and since Sendgrid had a transport plugin for nodemailer it was an easy choice for me. So this kind of openness made me a Sendgrid customer in the first place :-)

If this module uses the official sendgrid module under the hood and the official module does all the heavy lifting, isn't it only a matter of keeping the underlying module up to date and keeping the nodemailer api working?

With all that said, I understand if you don't want to put more resources into this module, in that case, maybe it's best if you let the community pick it up. I already see pull requests like this one that should move this forward.

mderazon avatar Dec 04 '16 12:12 mderazon

I'm choosing an emailer solution right now for an MVP project I am working on and in the past I have always chosen SendGrid as, in the past, it's been trivial to wire it into NodeMailer. I like NodeMailer because, during development or while running integration tests, I can easily drop back to the nodemailer-stub-transport or my mac's built-in Sendmail smtp server. I've looked at the 'official' sendgrid-nodejs library and the huge number of outstanding issues / PRs are a concern, and there does not appear to be any equivalent to the stub-transport for use in testing.

So I second the comment from @mderazon above. If Sendgrid does not have the resources to support its nodemailer transport then please could you release it into the wild and let the broader community maintain it. In the meantime I'll use this version which appears to be the most current fork.

davesag avatar Dec 07 '16 22:12 davesag

Hi @mbernier,

The reason I came to this thread was because I was going to setup a Ghost blog with Sendgrid and Ghost uses nodemailer, but I don't want to add username and password to my account in the blog config, in my opinion that is just wrong. I want to use an API key.

I don't know how many other projects use nodemailer, but if there are many other big projects like Ghost that does then maybe it would be good to either make pull requests to said projects to use your new official API libraries (that looks pretty nice btw), or to make a basic nodemailer wrapper around your new client so that it supports the basics of sending emails using a secure API key.

Cheers, Robert

Scorpiion avatar Jan 09 '17 01:01 Scorpiion

I have just tried nodemailer-sendgrid-transport with new account created via Heroku and it seems it is working. Is it ok to use it in production?

moravcik avatar May 22 '17 14:05 moravcik

Hi @moravcik,

Yes, the current version (that supports the v2 Web API), while no longer supported, is not being sunset.

Welcome to SendGrid! Glad to have you aboard :)

With Best Regards,

Elmer

thinkingserious avatar May 22 '17 16:05 thinkingserious

Looking forward for an official SendGrid V3 transport for nodemailer.

alexanderknapstein avatar May 31 '17 21:05 alexanderknapstein

Eh, I don't like their native API very much. Lots of object initialization. Doesn't feel very idiomatic for Node.js.

I just decided to call their API directly, and the code came out much cleaner:

const api = require('law-axios')
const sendgrid = api({
  json: true,
  domain: 'https://api.sendgrid.com/v3/',
  headers: {
    Authorization: 'Bearer ' + process.env.SENDGRID_KEY
  }
})

const body = {
  personalizations: [{to: [{email: to, name: toName}], subject}],
  from: {
    email: from,
    name: fromName,
  },
  reply_to: {
    email: from,
    name: fromName,
  },
  subject,
  content: [
    {type: 'text/html', value: html}
  ]
}
sendgrid('POST /mail/send', body, done)

Yeah, the cross-compatibility would be nice, but I'm willing to swap out 30 lines of code in the event that we switch carriers.

bitmage avatar Aug 23 '17 05:08 bitmage

Thanks for sharing your solution @bitmage! If you have a moment, we would like to send you some swag.

Have you checked out the new version of our SDK? It should be released very soon.

thinkingserious avatar Aug 23 '17 18:08 thinkingserious

I'm on a project where we use SES and we also need to send out email. Nodemailer is really easy to use with ses, smtp, and a variety of communication transports.

:-1: for dropping nodemailer support.

jsdevel avatar Oct 12 '17 22:10 jsdevel

Hi @jsdevel,

Please follow this issue for progress :)

thinkingserious avatar Oct 12 '17 22:10 thinkingserious

GitHub as an archive feature function, it would make it easier to understand for newcomers.

capture d ecran 2018-03-29 a 15 52 38

oliviertassinari avatar Mar 29 '18 13:03 oliviertassinari

That's interesting @oliviertassinari, I was not aware of this feature. I will look into whether that would be appropriate for this repo. For now, I'm thinking the announcement on the README should be sufficient.

With Best Regards,

Elmer

thinkingserious avatar Apr 02 '18 17:04 thinkingserious

Was there any update regarding the integration of the new API from sendgrid?

Berkmann18 avatar Jul 05 '18 15:07 Berkmann18

Yeah, switch to latest version of nodemailer and you have it: https://github.com/nodemailer/nodemailer-sendgrid

elboletaire avatar Jul 05 '18 16:07 elboletaire

I think it would be great to link to the nodemailer-sendgrid (https://github.com/nodemailer/nodemailer-sendgrid) library if this is no longer supported. I just struggled for a few hours trying to figure this out. With a fresh Sendgrid account (via Heroku), I installed nodemailer and nodemailer-sendgrid-transport.

Following the the installation instructions in this repo: https://github.com/sendgrid/nodemailer-sendgrid-transport/blob/master/USAGE.md

var nodemailer = require('nodemailer');
var sgTransport = require('nodemailer-sendgrid-transport');

// api key https://sendgrid.com/docs/Classroom/Send/api_keys.html
var options = {
  auth: {
    api_key: process.env.SENDGRID_API_KEY
  }
}

// or

// username + password
var options = {
  auth: {
    api_user: 'SENDGRID_USERNAME',
    api_key: 'SENDGRID_PASSWORD'
  }
}
  
var mailer = nodemailer.createTransport(sgTransport(options));

mailer.sendMail( {...properEmailStugg} ).then((resp) => {
// resp = undefined
// this fails silently...
// It did not throw an error and went to this .then() but resp was undefined and the 
// email was never sent...very frustrating
})

The sendMail function does not throw an error, but instead returns resp as undefined

For anyone reading this, I would recommend using the nodemailer-sendgrid package instead. But, note the difference in the options setup. It requires { apiKey: 'blah' } not { auth: { api_key: 'blah' } }

DaddyWarbucks avatar Jul 17 '18 19:07 DaddyWarbucks

Thanks for the heads up @DaddyWarbucks! I've added this to our backlog for review, it seems like a solid alternative until we can get this repo re-created here.

thinkingserious avatar Jul 24 '18 00:07 thinkingserious

Can I use smtp transport of nodemailer with sendgrid? What's correct configuration?

sheerun avatar Sep 19 '18 17:09 sheerun

Hello @sheerun,

We have a solution in the works, but it's still on the backlog.

With Best Regards,

Elmer

thinkingserious avatar Sep 28 '18 03:09 thinkingserious

If this is no longer supported, you should take down https://sendgrid.com/blog/sending-email-nodemailer-sendgrid/

It's the top link when searching "sendgrid nodemailer"

For future readers: this is the latest solution https://github.com/nodemailer/nodemailer-sendgrid

kusold avatar Oct 24 '19 19:10 kusold

As most people should have known by now, this project was moved to the main repo under the mail package.

Berkmann18 avatar Oct 28 '19 13:10 Berkmann18

ematiu created a PR #71 to update the README.md. It would be great to see the verbiage reviewed and get that PR merged in. That way others who came across this repo via the SendGrid blog article @kusold mentioned, can be made aware that this is replaced by the npm package @sendgrid/mail within the following repo: https://github.com/sendgrid/sendgrid-nodejs

ka05 avatar Oct 28 '20 20:10 ka05