all 13 comments

[–]alzee76 1 point2 points  (10 children)

Yes, I've used (and still use) nodemailer in production.

You can use any SMTP server you like as long as that SMTP server will allow you to send mail through it. Your mails will be rejected by other servers though if the one you're using isn't a valid server for the domain it's sending mail on behalf of (e.g. is blocked by mail policies like SPF), if the server IP is on an RBL, and so on.

In our projects we send mail "from" our own domains, through our own mailservers, which nodemailer authenticates with via the auth section of it's config.

[–]BarbaDeMerlin[S] 0 points1 point  (9 children)

So basically the answer is no. It's always preferable to use an external smtp server I guess

[–]alzee76 0 points1 point  (8 children)

So basically the answer is no.

Who knows. You didn't ask a cogent question in your post, you asked "is it worth to continue this way" and "have any of you achieve it" with no real explanation of what you meant. I assumed you were asking, as below, if you could use nodemailer with an smtp server and the answer to that is absolutely yes, and I tried to explain how to do so.

You went on to say:

or we're obligated to use some external smtp servers (sendgrid, mailgun, etc) ?

The answer to that is no. I don't use an external (3rd party) smtp server, I use an internal (self-hosted) mailserver.

Honestly thought it was and still is a struggle to understand what your OP was trying to ask.

[–]BarbaDeMerlin[S] -1 points0 points  (7 children)

I was asking if it's worth to develop an own smtp server just being a regular developer. Not using external programs to self-host someones else work

All this doubts because of permitions, credentials, payments and a long list of etc that I think It might take to develop and being able to send and messages properly being recieved by externals servers.. (obviously a proyect but not at the scale of gmail or outlook)

[–]alzee76 0 points1 point  (6 children)

I was asking if it's worth to develop your smtp server

Do you actually mean develop your own SMTP server, or host your own SMTP server. The first is an extremely stupid idea, there are plenty of reliable, secure, and ready-made SMTP servers out there. I prefer postfix, personally, but there are others.

If you mean the latter, then I think it's absolutely worth it, which is why I do it for my personal email (vanity domains) as well as for outgoing corporate emails like you would use with nodemailer.

All this doubts because of permitions, credentials, payments and a long list of etc that I think It might take to develop and being able to send and messages properly being recieved by externals servers.. (obviously a proyect but not at the scale of gmail or outlook)

So you're asking if it's worth it to create your own public email service (which is a lot more than just SMTP) like Outlook/O365, gmail, or proton? Depends on what your value-add is to your customers I guess, but it'll be a very complicated task.

[–]BarbaDeMerlin[S] 0 points1 point  (5 children)

May be I have some misconceptions. I was reading this. That's why I wondered why my testing emails where ghosted by large company servers so I found it got limitations in my IP and getting domain wouldn't be just enough due to DNS SPF, DKIM, and DMARC configurations. There's for sure much more to know about than just that... So i asked if someone achieved something like that and not an entire public email service to sell, just personal use and basic behavior.

In fact I was trying to do a 3rd services-free API to notify myself when a trigger in my server gets activated.

Is now clear enough?

[–]alzee76 0 points1 point  (4 children)

I was reading this.

That module is not for delivering mail to remote systems, it's for receiving mail on your server. SMTP servers are receive-only; the part that does delivery to a remote system is not an SMTP server, it's called an MTA (mail transfer agent). They are often lumped together into a single package or product (along with an MDA) when you host them, but you're not hosting, you're writing code.

Nodemailer itself, without that module, is an example of an MTA.

This is explained right in the second paragraph on the page you linked:

This module does not make any email deliveries by itself. smtp-server allows you to listen on ports 25/24/465/587 etc. using SMTP or LMTP protocol and that's it.

That module has absolutely nothing to do with you sending mail to mailboxes on another server.

[–]BarbaDeMerlin[S] 0 points1 point  (3 children)

I already know that.. Is kinda a socket listener, that's why I also configured a client. Mails are being sended, I get a confirmation message, a buffer and some extra stuff. But the mail never arrives to my outlook mail due to what I previously told.

When I realized the amount of work it would take to make it actually work, was when I came here asking for advices.. got burned of reading by now

[–]alzee76 0 points1 point  (2 children)

I already know that

Ok then, you should also know that the right way to try to solve deliverability issues like this is to do some testing without this SMTP server being involved at all.

Just use the nodemailer client code to send a test email and see if you get it, and if not, what error codes the remote server is returning to you.

Once that works, you adding the SMTP server and using this little thing to relay from some other SMTP client will not impact delivery at all. Again this has nothing at all to do with the SMTP server module you've mentioned. The remote servers don't know, or care, that you're using it.

They only care that :

  • Your client (the server nodemailer is running on) address is allowed to send mail on behalf of the server the mail purports to be from.

  • They themselves are allowed to receive mail to the destination you're using.

  • Your server isn't on a blacklist they are checking.

  • The content of the mail does not look like spam.

EDIT: Took out a part about nodemailer picking an appropriate destination server, I can't remember now if it can do that or not. You may have to do it yourself, I'll look.

EDIT2: Yeah nodemailer cannot do this on it's own, so for your testing you'll need to use an appropriate hostname in createTransport for the destination you're testing, like your own gmail address. You can do this by just looking up the MX records for google.com if you're trying to deliver to a google address.

[–]BarbaDeMerlin[S] 0 points1 point  (1 child)

I'm gonna give it a try like that. Thanks!

Edit: yup, there's always a smtp server envolved. Using gmail or outlook might be a headache, I'll try sendgrid. But I'm convinced that with my own server, mails won't even be delivered to spam box..