News for hackers. Stuff that matters.
Re:Mailit: A Tiny Drop-In REST API to Send Emails by bjpbakker on Tuesday August 01, 2017 @04:00AM (#14898651)
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 IMO makes things only more complicated.

Re:Mailit: A Tiny Drop-In REST API to Send Emails by icebraining on Tuesday August 01, 2017 @04:27AM (#14898756)
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).
Re:Mailit: A Tiny Drop-In REST API to Send Emails by mariusmg on Tuesday August 01, 2017 @06:01AM (#14899158)
>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 by icebraining on Tuesday August 01, 2017 @06:17AM (#14899221)
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 by bjpbakker on Tuesday August 01, 2017 @07:06AM (#14899444)
> 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 by icebraining on Tuesday August 01, 2017 @07:29AM (#14899583)
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 by joantune on Tuesday August 01, 2017 @07:16AM (#14899504)
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 by jsudhams on Tuesday August 01, 2017 @06:09AM (#14899189)
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 by Rjevski on Tuesday August 01, 2017 @06:17AM (#14899222)
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 by ctrlrsf on Tuesday August 01, 2017 @08:33AM (#14899950)
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 by w458cmau on Tuesday August 01, 2017 @07:41AM (#14899642)
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.
Re:Mailit: A Tiny Drop-In REST API to Send Emails by zAy0LfpBZLC8mAC on Tuesday August 01, 2017 @08:04AM (#14899779)
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 by bjpbakker on Tuesday August 01, 2017 @08:11AM (#14899821)
> 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 by zAy0LfpBZLC8mAC on Tuesday August 01, 2017 @09:16AM (#14900279)
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 by kowdermeister on Tuesday August 01, 2017 @05:09AM (#14898910)
I've looked at setting up sendmail as a "LAMP guy" and I said nope nope nope, just use mailgun.
Re:Mailit: A Tiny Drop-In REST API to Send Emails by laumars on Tuesday August 01, 2017 @05:21AM (#14898963)
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 controls like rate limiting in place - again so you don't just get rejected as spam.

Honestly, I would welcome a complete ground up re-implementation of email - SMTP, POP/IMAP and all. The "very simple protocol, that's matured for decades now" is really just a mess of different protocols - different authentication models, different encryption methods, etc and all operating without a standard format for error handling. Plus all of the additional bloat bolted on to handle the swell of abuse that the email "network" has had to endure. There's nothing simple about email any more.

However going back to the topic: the unfortunate thing about this REST API is it seeks to solve the least complicated part of the whole SMTP stack.

Re:Mailit: A Tiny Drop-In REST API to Send Emails by kowdermeister on Tuesday August 01, 2017 @05:36AM (#14899024)
Thanks, I missed that part, I thought drop in means it handles most of the things :)

I'd welcome that too, it's kinda sad nobody succeeded with "email 2.0", sure we have lots of attempts but I can't recall any major players. The best solutions to "fix email" were companies that advocated to not use email and use their closed platform.

What I can think of would be cool is something XMPP based with email fallback.

Re:Mailit: A Tiny Drop-In REST API to Send Emails by vram22 on Tuesday August 01, 2017 @08:11AM (#14899819)
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 by vram22 on Tuesday August 01, 2017 @11:58AM (#14902101)
>it's name was

Sorry, "its name was" :)

Still forget that rule sometimes.

http://data.grammarbook.com/blog/pronouns/1-grammar-error/

Re:Mailit: A Tiny Drop-In REST API to Send Emails by kennydude on Tuesday August 01, 2017 @06:12AM (#14899202)
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 by pmlnr on Tuesday August 01, 2017 @05:14AM (#14898932)
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.

Re:Mailit: A Tiny Drop-In REST API to Send Emails by beaconstudios on Tuesday August 01, 2017 @05:53AM (#14899113)
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 by kowdermeister on Tuesday August 01, 2017 @05:22AM (#14898968)
Sending is not the tricky part, implementing it right is probably another story.

I wouldn't call it massive overkill. REST is extremely simple as well. You have to make an request anyways so it's just a question of preference how you connect to that the email sending service.

Re:Mailit: A Tiny Drop-In REST API to Send Emails by bjpbakker on Tuesday August 01, 2017 @05:29AM (#14899004)
> implementing it right is probably another story

Do you implement your own HTTP communication every time you need it or do you use a library?

Just as for HTTP there are many good libraries for SMTP communication that you can easily use. No need to roll your own.

Re:Mailit: A Tiny Drop-In REST API to Send Emails by pmlnr on Tuesday August 01, 2017 @05:26AM (#14898984)
> I wouldn't call it massive overkill.

You're running a web server to emulate telnet. It's a massive overkill.

Re:Mailit: A Tiny Drop-In REST API to Send Emails by fundabulousrIII on Tuesday August 01, 2017 @09:20AM (#14900320)
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.
Re:Mailit: A Tiny Drop-In REST API to Send Emails by vinaysshenoy on Tuesday August 01, 2017 @10:10AM (#14900764)
We were sending email via SMTP from our Android apps for a while until we ran into quite a few cases where SMTP was blocked at the router level. We had to move to HTTP mailing to let the mails go through.
Re:Mailit: A Tiny Drop-In REST API to Send Emails by Michielvv on Saturday August 05, 2017 @04:43AM (#14934809)
In our case the reason we switched from SMTP to an HTTP API was mostly speed. At least for Sendgrid, their HTTP API is much faster than SMTP.

In general I agree that I'm not seeing a big advantage in having another service to keep up and maintain, just to wrap SMTP.

Re:Mailit: A Tiny Drop-In REST API to Send Emails by BrandoElFollito on Wednesday August 02, 2017 @03:25PM (#14913776)
For instance to send messages from client only web applications where the only thing you have is an AJAX call.
Re:Mailit: A Tiny Drop-In REST API to Send Emails by z3t4 on Tuesday August 01, 2017 @05:19AM (#14898953)
For example to make it possible for a static (client only) web app to send mail. Watch out for spammers though! It should be secure by default, because most people either don't care or don't know how to change the defaults!
Re:Mailit: A Tiny Drop-In REST API to Send Emails by pmlnr on Tuesday August 01, 2017 @06:27AM (#14899269)
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 by lugg on Tuesday August 01, 2017 @07:10AM (#14899461)
> 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 by GordonS on Tuesday August 01, 2017 @02:51PM (#14904041)
Having an RFC hardly means it's not simple; it means it has a well-defined specification.

Do you actually think HTTP isn't specified in an RFC?