News for hackers. Stuff that matters.
Re:The rise of the API-based SaaS by AznHisoka on Friday February 26, 2016 @03:34PM (#11184012)
I think OP is making it more complicated than it really is. Just abstract the logic as much as possible, confining it into 1 place. For instance, just have a class EmailSender with the method "sendEmail", and have all your clients call this class whenever they need to send an email

Now if you moved to SES from Mandrill, you just change it in 1 place. It's not rocket science or voodoo.

Re:The rise of the API-based SaaS by gingerlime on Friday February 26, 2016 @05:23PM (#11184744)
Or isn't SMTP the universal driver / adapter in this case? Which all those email providers support as far as I know.

Then you don't even change the code, but just configuration.

APIs are great, but I'd say protocols (or at least the well adopted ones) are better.

Re:The rise of the API-based SaaS by tomschlick on Friday February 26, 2016 @05:36PM (#11184816)
SMTP is also 3-10x slower than a simple POST request though. If you're sending 10,000 emails an hour that adds up.
Re:The rise of the API-based SaaS by icebraining on Friday February 26, 2016 @06:53PM (#11185216)
Why is SMTP slower? You can open a connection, authenticate and then send as many emails as you want. Doesn't seem slower than sending POST requests with their headers and such.
Re:The rise of the API-based SaaS by tracker1 on Friday February 26, 2016 @07:40PM (#11185443)
SMTP must maintain a transient state throughout the connection and respond to interactive requests...

HTTP-POST can handle the request chain inline, and deliver a single response, the decision tree is much lighter.

For that matter, HTTP-POST can partially to completely defer all processing decision trees, always returning 200 OK, offloading to a queue system that will process the request out of band, and issue the real response errors via a dashboard. Making it lighter still.

Re:The rise of the API-based SaaS by baudehlo on Friday February 26, 2016 @07:33PM (#11185424)
The technical answer is it's complicated.

SMTP is chatty. Even when you use PIPELINING. It tends to send way more packets than HTTP. And while you can open one connection and send multiple mails through it, the likelihood of your client library doing that is pretty low, sadly.

Re:The rise of the API-based SaaS by tomschlick on Friday February 26, 2016 @07:04PM (#11185271)
In theory yes, in practice that's usually not the case in my experience.
Re:The rise of the API-based SaaS by tomschlick on Friday February 26, 2016 @03:36PM (#11184029)
Thats true. I use abstraction a little further because we have the need for multiple email providers at once. But there is nothing wrong with doing it the way you described.