oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.8k stars 2.56k forks source link

Standard library support for sending email via SMTP #1652

Open chrisdavies opened 1 year ago

chrisdavies commented 1 year ago

What is the problem this feature would solve?

When building basic web apps, we almost always need to send email. It'd be handy if this was baked into the Bun std library the way it is for .NET and Go.

What is the feature you are proposing to solve the problem?

A basic SMTP client library for sending email.

What alternatives have you considered?

There are plenty of npm packages that solve the problem (e.g. nodemailer), but one of the nice things about Bun is being able to do a whole lot without dependencies.

chrisdavies commented 1 year ago

I spent a bit of time tinkering with building this out, but it's partially blocked by #781

In order to implement TLS via SMTP, I need to be able to upgrade a TCP connection which doesn't seem possible via the current Bun TCP API. With Node, this would be done via tcp.connect on an existing / connected socket. You can see Nodemailer's usage of that here

mantissa7 commented 4 months ago

I spent a bit of time tinkering with building this out, but it's partially blocked by #781

In order to implement TLS via SMTP, I need to be able to upgrade a TCP connection which doesn't seem possible via the current Bun TCP API. With Node, this would be done via tcp.connect on an existing / connected socket. You can see Nodemailer's usage of that here

Did this ever get solved? The blocker link goes to a 404 page now.

I've just come across this issue wanting to fire off an email using a simple SMTP client. Nodemailer is obviously tailored to Node.js, and having this baked into Bun would be great.