News for hackers. Stuff that matters.
Re:Ethereal Email – A fake SMTP service by justboxing on Thursday October 05, 2017 @05:28PM (#15412712)
Not trolling, but why would any developer need a service like this? Isn't that what Mocking frameworks and Interfaces (Interface driven design) are for?

Ex: I would create an interface called IMailService with the operations like Send etc, and once my application is ready, just swap the concrete implementation of the MailService class with the one that talks to the real mail service using Dependency Injection.

If it's not for developers, who would use something like this?

Re:Ethereal Email – A fake SMTP service by itake on Thursday October 05, 2017 @06:45PM (#15413138)
We use mailcatcher[0] on our sandbox server so that product and QA can test email features in a live environment. Mailcatcher was a drop in replacement with our existing codebase. No need to add in additional business logic specific for testing or have to write our own interface to expose the "sent" emails.

[0] https://mailcatcher.me/

Re:Ethereal Email – A fake SMTP service by brightball on Thursday October 05, 2017 @10:35PM (#15414060)
Yep. Mailhog is another good one.

For staging environments I like Mailtrap.io because it's a cleaner interface for non-devs.

Re:Ethereal Email – A fake SMTP service by itake on Friday October 06, 2017 @03:16AM (#15414984)
You get what you pay for :). mailcatcher is OSS and self hosted. Mailhog definitely looks prettier.
Re:Ethereal Email – A fake SMTP service by justboxing on Thursday October 05, 2017 @07:19PM (#15413301)
[RETRACTED].

My bad.

Re:Ethereal Email – A fake SMTP service by thegeomaster on Thursday October 05, 2017 @08:14PM (#15413552)
It appears to me that mailcatcher linked by the parent is free and open source.
Re:Ethereal Email – A fake SMTP service by andris9 on Thursday October 05, 2017 @09:56PM (#15413907)
Ethereal.email is also open source so it can be installed locally https://github.com/nodemailer/ethereal-www
Re:Ethereal Email – A fake SMTP service by itake on Friday October 06, 2017 @05:25AM (#15415464)
True, but ethereal.email requires mongodb and redis. whereas mailcatcher just uses sqlite. no need to install extra apps.
Re:Ethereal Email – A fake SMTP service by amigoingtodie on Thursday October 05, 2017 @05:39PM (#15412773)
So, I have an application that sends alerts via email and 'sms', and to save costs for some sms messages, I use the cell provider's email address w/ the user's phone number.

These alerts can go to a user and/or a user's supervisor(s).

Additionally, the content of the message is dynamic.

This service would be very easy to add as a config option and let non-technical coworkers test the application for accuracy.

Also, I will know that SMTP is actually working.

Otherwise, I need to write the code and a UI for the non-technical coworker, and a way to store it. I have other things I need to work on.

Re:Ethereal Email – A fake SMTP service by brazzledazzle on Thursday October 05, 2017 @08:34PM (#15413629)
Not sure what you're alerting for so maybe it doesn't matter but I just wanted to warn you about using sms mail gateways. Most of the time the email gateways work (with varying delays) but I've seen every major provider fail or take days to deliver when I needed it the most.
Re:Ethereal Email – A fake SMTP service by amigoingtodie on Thursday October 05, 2017 @08:52PM (#15413704)
I know. We use Twilio for the 'important' alerts and the gateways for 'nice to have'.

But, as you said, it can be iffy, so that is why I want to know if the issue is with stuff I control, or them.

So, at least I know it is being sent and my logic is solid.

Re:Ethereal Email – A fake SMTP service by brazzledazzle on Thursday October 05, 2017 @11:52PM (#15414304)
That’s a smart way to do it.
Re:Ethereal Email – A fake SMTP service by amigoingtodie on Friday October 06, 2017 @05:42AM (#15415516)
Thanks.
Re:Ethereal Email – A fake SMTP service by rqs on Friday October 06, 2017 @05:43AM (#15415519)
I was once trying to develop a SMTP sender lib for PHP.

After reading a lot's of RFC's, I found it's really helpful to test my code against some standard SMTP server so I can know my code is work as expected.

But a real SMTP server is not an option as they all have some kind of filters and server settings that will interfere my test, + In this case, I don't think doing TDD with a real working commercial server (i.e Gmail, Outlook etc) is a good idea. It's not only slow, but also wasting (their resources).

That's when a fake SMTP server come in handy. Because not only you can use them to Send a lot's of mail, also those emails will not generate any (I hope) real world side effect.

Re:Ethereal Email – A fake SMTP service by emidln on Thursday October 05, 2017 @09:00PM (#15413734)
I'd probably set SMTP_URI in my environment or as a java property and just use that to configure my SMTP service. While an Interface and DI might be useful for unit testing, when I'm testing in integration, ci, or qa environments, I'd want to make sure that I'm using an SMTP server that can't send emails to the outside world. Postfix is pretty easy to setup for this scenario (a whitelist of users/domains to forward mail for) so I can still test mail output.
Re:Ethereal Email – A fake SMTP service by nathancahill on Thursday October 05, 2017 @06:08PM (#15412940)
Relevant story from my friends at Fetchnotes: https://web.archive.org/web/20161114132954/http://blog.fetch...
Re:Ethereal Email – A fake SMTP service by eesmith on Thursday October 05, 2017 @05:49PM (#15412832)
How do you test your mocks to ensure they match real SMTP/IMAP/POP client behavior?

If the same developers write the clients and the mocks, then it's likely that both components implement identical misunderstandings, if there are misunderstandings.

Re:Ethereal Email – A fake SMTP service by a-nikolaev on Thursday October 05, 2017 @07:43PM (#15413428)
You can run your program with a testing set of users, where all potential receivers of your mock messages are your own emails. Is it not enough?
Re:Ethereal Email – A fake SMTP service by eesmith on Thursday October 05, 2017 @08:41PM (#15413650)
It's what I do. However, I rarely integrate with email, and when I do it's for in-house email addresses.

That said, I was giving an example of why a mock might not be an appropriate solution, and not on the wider topic of what "enough" might be.

I can certainly think that testing the ability to send emails to, say, 5,000 different addresses, and check that they are received, might be easier with something like this system.

Re:Ethereal Email – A fake SMTP service by stingraycharles on Thursday October 05, 2017 @05:33PM (#15412752)
Sometimes you want to do a higher level integration / end to end test. Consider for example where you’re testing a docker image and need to provide an SMTP endpoint. This could be a solution.