nodemailer-sendgrid-transport
nodemailer-sendgrid-transport copied to clipboard
(Nodemailer) Why isn't this supported anymore?
Maybe can I adopt it? Or is there a specific reason for deprecation?
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.
I was looking at the nodemailer
yesterday and what I liked about it is that it allows the same public interface, across multiple providers.
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 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:
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!!
I agree! 👍
So... what is the recommended library for sending e-mails in nodemailer using SendGrid? This is not very clear to me.
@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!
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.
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.
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
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?
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
Looking forward for an official SendGrid V3 transport for nodemailer
.
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.
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.
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.
GitHub as an archive feature function, it would make it easier to understand for newcomers.
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
Was there any update regarding the integration of the new API from sendgrid?
Yeah, switch to latest version of nodemailer and you have it: https://github.com/nodemailer/nodemailer-sendgrid
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' } }
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.
Can I use smtp transport of nodemailer with sendgrid? What's correct configuration?
Hello @sheerun,
We have a solution in the works, but it's still on the backlog.
With Best Regards,
Elmer
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
As most people should have known by now, this project was moved to the main repo under the mail
package.
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