3 ms·
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 intro
by csomar 9y ago
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!
- bjpbakker 9y agoFor 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.
- askz 9y agoMailIt doesn't provide a SMTP server. Instead it takes your existing SMTP settings, so you can take the advantage of your existing reputation, or your provider's one. (assuming you already have an email account somewhere, and it can be gmail, outlook, [popularprovider]...)
- StavrosK 9y agoI don't really understand what you gain from this. SMTP is much more widespread than this API. If you want to migrate to a service later on, all you need to do is change the hostname to that service, how much easier is it to have to babysit a service in a container?
- dc2 9y agoAuthor here. There seems to be a lot of discussion over use cases. Here's the use case I built it for: All traffic for my (large) application hits a load balanced API gateway. Its role is to authenticate and forward requests to one of many services. The gateway is the only point of exposure to internal services. After something has cleared the gateway on a route with roles approved for that user, there is little worry about security. Certificates between servers and containerized deployments such as Kubernetes help on this as well. I'm not going to write email-sending logic in my gateway. It just handles AAA and then proxies the request. By forwarding to microservices instead of a monolith, I can scale workload better and have less risk of a mail bug taking down other services.