Live data from Hacker News

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

github.com

41–50 of 75 posts

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

#42

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.

I can't comment on what seems simpler to you, but ... what does intermittent connectivity have to do with whether you transmit the email via SMTP or via HTTP?

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

#43
post #16

Earlier quoted context omitted.

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

You still need to set up the SMTP server with this solution. Creating the relay is the hard part of any mail service because even SMTP aside, you need to set DNS entries on your FROM domain to authorise your SMTP relay's IP (otherwise spam filters will just block your email). And if it's regular commercial mailshots then you'd need to register with one of the trusted services (which isn't free) and have all sorts of…

Yes, good point about email being complex to implement - both the server and the clients that use it. Example: Some years back, I remember reading a book (I think from O'Reilly) about using programming email, by an author called David Wood [1].

Update: I just did this google search:

java and email book david wood

and looked at the results.

The first hit is that book - it's name was actually Programming Internet Email - and it was by O'Reilly Media:

http://shop.oreilly.com/product/9781565924796.do

It has info on both the fundamental concepts and protocols of email, as well as examples in both Perl and Java.

Other results of that search show that there are multiple books about programming email (as can be expected), including a list of books about Internet email on an Oracle site:

Books on the JavaMail API and Internet Mail:

http://www.oracle.com/technetwork/java/javamail/index-139773...

Not all of those are exclusively about email, and some probably have overlapping content, but still, it shows (as Wood's book did too) that it is a big topic:

JavaMail API, by Elliotte Rusty Harold.

Internet Email, by David Wood.

Programmer's Guide to Internet Mail, by John Rhoton.

Internet Email Protocols: A Developer's Guide, by Kevin Johnson.

Java Network Programming, 2nd Edition, by Elliotte Rusty Harold.

Essential Email Standards: RFCs and Protocols Made Practical, by Pete Loshin.

Internet Messaging: From the Desktop to the Enterprise, by Marshall T. Rose and David Strom.

Internet E-Mail: Protocols, Standards, & Implementation, by Lawrence Hughes.

Managing IMAP, by Dianna Mullet and Kevin Mullet.

Professional Java Server Programming J2EE Edition.

Java Cookbook: Solutions and Examples for Java Developers, by Ian F. Darwin.

JavaServer Pages (JSP) Fast & Easy Web Development, by Aneesha Bakharia.

[1] From what I read about David Wood, he seemed to have a lot of experience with email (and other stuff) and had for some time, a company providing products and/or services in that area.

http://www.oreilly.com/pub/au/565

And that Java Cookbook by Ian Darwin is pretty good too - I have it.

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

#44

Earlier quoted context omitted.

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.

I can't comment on what seems simpler to you, but ... what does intermittent connectivity have to do with whether you transmit the email via SMTP or via HTTP?

> what does intermittent connectivity have to do with whether you transmit the email via SMTP or via HTTP

SMTP uses a stateful connection where HTTP is basically a single request/response. I.e. the device can close the HTTP connection after a single roundtrip where SMTP requires waiting for server responses after commands and then continuing the request.

Not sure if it's simpler on those devices to use an HTTP interface (because HTTP requires a bit more overhead data) but it might be simpler, sure.

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

#45

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.

The latter is a terrible idea: Mail servers as well as networks can and do fail temporarily, that should not prevent you from sending emails to addresses hosted on those servers, that is exactly what MTA queuing is there for.

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

#46
post #28

Earlier quoted context omitted.

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.

Spam malware can scan IPs to find open SMTP ports to send spam so some ISPs and hosting providers lock down these ports to avoid getting their IPs blacklisted when a compromised host starts sending a bunch of spam through an open relay. I can see this being used to send email out from some restricted hosting providers.

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

#49

Earlier quoted context omitted.

I can't comment on what seems simpler to you, but ... what does intermittent connectivity have to do with whether you transmit the email via SMTP or via HTTP?

> what does intermittent connectivity have to do with whether you transmit the email via SMTP or via HTTP SMTP uses a stateful connection where HTTP is basically a single request/response. I.e. the device can close the HTTP connection after a single roundtrip where SMTP requires waiting for server responses after commands and then continuing the request. Not sure if it's simpler on those devices to use an HTTP interf…

HTTP runs on top of TCP, which already gives you at least two round trips. Also, if it's a device that's connected via the public internet, you probably should be using TLS, which gives you a couple more round trips.

Really, realistically, if your internet connectivity is too bad to support SMTP, it most likely won't work for HTTP either, and you probably should be using some custom UDP thingy with an appropriate retry strategy.

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

#50

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.

Nobody I know in the SA community uses sendmail much anymore. Maybe there are a few holdouts but if someone gave me the task of standing up an MTA it would be postfix.
Post reply on HN