Live data from Hacker News

Mailit: A Tiny Drop-In REST API to Send Emails

github.com

31–40 of 75 posts

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#31
post #9
post #5

Earlier quoted context omitted.

> This service defaults to no authentication.

That default really did not work out well for MongoDB[1]. Why are we perpetuating this mistake? [1] https://www.bleepingcomputer.com/news/security/mongodb-apoca...

Perhaps, more importantly, that didn't work out very well for smtp either ; aka "open relay".

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#32

It migt be just me, but I honestly don't understand why people would use an HTTP API to send mail. SMTP really is a very simple protocol, that's matured for decades now. Also it is fully specified by RFCs. I can see why mail services that provide templating (eg Mandrill) have special APIs, they offer something different from sending regular emails. This specific REST API seems more like a standin for sendmail, which…

Gmail is IMAP and SMTP, and Google Talk is (or was) XMPP, all on port 80 in the same browser window. Others are more metaphorical. Twitter is IRC on port 80, although one primarily listens to users instead of channels — but listening to channels is still possible, if one uses a client that can follow hashtags, and the syntax is even the same. Dropbox is FTP on port 80. Reddit is Usenet on port 80.

https://medium.com/@maradydd/on-port-80-d8d6d3443d9a

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#33
I really like this approach.

Let's say you want to build a first beta. You are going to use your own server for sending mail to reduce costs and also not introduce dependencies early on.

There are two ways to do it:

1. Call the SMTP library like some here suggested.

2. Create your own encapsulation of the SMTP functionality, and call these functions to send email.

It is obvious why you want to use 2. But, from experience, it makes your code base bigger and debugging more problematic.

By using a Docker container, you are separating matters: Now sending emails is a small service that can scale in the future, but doesn't consume lots of resources today.

With a docker/rest api, it also means that have you decided to switch to Mailchimp in the future; it'll be an easy task. You don't have to go through all your code and look which parts send emails and update them. You don't have to update your library encapsulation. You don't have to redeploy your whole instance to update the code.

All you do is create a new docker instance and then shutdown the old one. Tada!

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#34
Could do with an end-point to do some basic validation of email addresses. I.e a syntax check, and also a DNS check to make sure that the domain has MX or A/AAAA records, and potentially a check to make sure that there is an SMTP server listening at the destination on port 25. Perhaps all 3 of those things configurable at request time.

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#35
post #33

I really like this approach. Let's say you want to build a first beta. You are going to use your own server for sending mail to reduce costs and also not introduce dependencies early on. There are two ways to do it: 1. Call the SMTP library like some here suggested. 2. Create your own encapsulation of the SMTP functionality, and call these functions to send email. It is obvious why you want to use 2. But, from experi…

For a first beta (MVP?) I would strongly advice against using your own mail server. It takes a while for a server to build up a reputation, hence mails from an "unknown" server are quicker marked as spam (especially by common services like gmail and outlook).

Instead configure a local sendmail (so you have all the benefits of local mail delivery, like queuing and availability so on) to relay through your provider's mail servers.

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#36

Earlier quoted context omitted.

>SMTP has some back-and-forth stateful chatter. So what ? Is not like you implement the SMTP protocol into your application to send emails. Any language under the sun has a SMTP implementation exposed as a library.

It's slower, which is important when you're trying to push a lot of emails. If you keep the TLS connection open, sending an HTTP request is very fast. Waiting for the roundtrips of that chatter reduces the throughput, especially on higher latency links.

> If you keep the TLS connection open, sending an HTTP request is very fast. Waiting for the roundtrips of that chatter reduces the throughput, especially on higher latency links.

I agree that for a high load of sending email it can be beneficial to use an intermediate service. IMO a local sendmail is still preferred, but I see your point.

However, the Mailit service makes the client wait on the SMTP traffic too [1]. So with this particular service you now have to wait for both SMTP /and/ HTTP communication. Doesn't really speed thinks up :)

[1] https://github.com/dthree/mailit/blob/master/src/routes.js#L...

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#37

It migt be just me, but I honestly don't understand why people would use an HTTP API to send mail. SMTP really is a very simple protocol, that's matured for decades now. Also it is fully specified by RFCs. I can see why mail services that provide templating (eg Mandrill) have special APIs, they offer something different from sending regular emails. This specific REST API seems more like a standin for sendmail, which…

> SMTP really is a very simple protocol, that's matured for decades now. Also it is fully specified by RFCs.

So simple and so mature it needs an RFC.

I'll take the http API I can figure out in 10 seconds because I make API requests all day over some ancient tech I don't even want to begin to understand.

Does that make me lazy and a shit developer? Probably. Do I care. Definitely not.

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#38

Earlier quoted context omitted.

>SMTP has some back-and-forth stateful chatter. So what ? Is not like you implement the SMTP protocol into your application to send emails. Any language under the sun has a SMTP implementation exposed as a library.

It's slower, which is important when you're trying to push a lot of emails. If you keep the TLS connection open, sending an HTTP request is very fast. Waiting for the roundtrips of that chatter reduces the throughput, especially on higher latency links.

We have configured at work an intermediate postfix for this effect, but it takes a bit to learn how to configure it

So I can see the benefits of this approach

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#39

Earlier quoted context omitted.

It's slower, which is important when you're trying to push a lot of emails. If you keep the TLS connection open, sending an HTTP request is very fast. Waiting for the roundtrips of that chatter reduces the throughput, especially on higher latency links.

> If you keep the TLS connection open, sending an HTTP request is very fast. Waiting for the roundtrips of that chatter reduces the throughput, especially on higher latency links. I agree that for a high load of sending email it can be beneficial to use an intermediate service. IMO a local sendmail is still preferred, but I see your point. However, the Mailit service makes the client wait on the SMTP traffic too [1].…

However, the Mailit service makes the client wait on the SMTP traffic too [1]. So with this particular service you now have to wait for both SMTP /and/ HTTP communication. Doesn't really speed thinks up :)

That depends, you could host the Mailit service in the same machine as the email server, which your application instances on other machines would call. This could be useful if you have multiple machines but only want to run a single email server.

Re: Mailit: A Tiny Drop-In REST API to Send Emails

#40

It migt be just me, but I honestly don't understand why people would use an HTTP API to send mail. SMTP really is a very simple protocol, that's matured for decades now. Also it is fully specified by RFCs. I can see why mail services that provide templating (eg Mandrill) have special APIs, they offer something different from sending regular emails. This specific REST API seems more like a standin for sendmail, which…

I want to send mails from embedded devices, similar to e.g. an ESP8266, with intermittent connectivity and a semi-stable power source. An HTTP API seems simpler for me to interface with than SMTP.
Post reply on HN