Live data from Hacker News

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

github.com

21–30 of 75 posts

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

#22
post #14

Earlier quoted context omitted.

I've looked at setting up sendmail as a "LAMP guy" and I said nope nope nope, just use mailgun.

Sendmail is everything but simple. The question was SMTP in general, which indeed is an extremely simple protocol. Here, this is how you send a plain text* mail in python: https://petermolnar.net/not-mime-email-python-3/ Using an HTTP API for this is a massive overkill. * I'm aware using utf-8 like this may confuse older clients but I didn't have problem with anything relatively modern I tested the receiving on.

nowadays you have the option of using postfix+dovecot, which for me at least seems to be a lot easier.

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

#23

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…

Playing Devil's advocate: SMTP has some back-and-forth stateful chatter. With a custom HTTP API, you can authenticate and send an email in a single request. SMTP Pipelining can reduce this problem, but not all libraries support it (e.g. Python's smtplib).

>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.

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

#24

Earlier quoted context omitted.

Playing Devil's advocate: SMTP has some back-and-forth stateful chatter. With a custom HTTP API, you can authenticate and send an email in a single request. SMTP Pipelining can reduce this problem, but not all libraries support it (e.g. Python's smtplib).

>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.

Another reason i would do is , i have only port 80/443 allowed outside my network. so using https api helps with that

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

#25

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've looked at setting up sendmail as a "LAMP guy" and I said nope nope nope, just use mailgun.

Mailgun works with SMTP [0]. Using SMTP means you're not locking yourself into one vendor, in case Mailgun does something like Mandrill where they dramatically increase the price

[0] https://documentation.mailgun.com/en/latest/quickstart-sendi...

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

#26

The total opposite of this project would be way more useful : A sendmail replacement that can call a REST / Webhook endpoint. You'll get free alerting directly from crontab/smartd/zfs to your monitoring / logging system

Kenneth Reitz's inbox.py does 99% of that for you. Just add a call to requests (also by reitz) and you are good.

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

#27

Earlier quoted context omitted.

Playing Devil's advocate: SMTP has some back-and-forth stateful chatter. With a custom HTTP API, you can authenticate and send an email in a single request. SMTP Pipelining can reduce this problem, but not all libraries support it (e.g. Python's smtplib).

>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.

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

#28

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.

Another reason i would do is , i have only port 80/443 allowed outside my network. so using https api helps with that

Why is that? What security does it provide? This very project just demonstrated that you can send pretty much anything in HTTP(S) so any malware (I presume) you're trying to defeat can do the same.

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

#29
I wouldn't add another HTTP layer for a functionality that is within my own app / network, unless I were to expose this as a service for outside the network as a service.

I would think that this is bad design - call a http service that wraps smtp, when pretty much every language has an SMTP client.

Post reply on HN