mcgruff
2022-02-23 19:44:17 UTC
I need a "dummy" SMTP server to test if some code can send emails correctly and I'd like to use Postfix for this.
Emails (obviously) shouldn't be sent to the recipient list. I only need them saved in a file somewhere so I can read the file and make assertions with a unit test framework: from, to, subject, content etc.
Additionally, I'd need to identify any Postfix-generated errors - no recipient address specified, invalid email address formats etc. I expect the unit test framework can find these by reading Postfix logs, so that should be straightforward.
But any tips how to configure Postfix to dump outgoing emails to file(s) instead of sending? Perhaps I need another piece of software working with Postfix to do this?
Even just a general outline would be a great help. I can probably figure out the details.
Thanks :)
Emails (obviously) shouldn't be sent to the recipient list. I only need them saved in a file somewhere so I can read the file and make assertions with a unit test framework: from, to, subject, content etc.
Additionally, I'd need to identify any Postfix-generated errors - no recipient address specified, invalid email address formats etc. I expect the unit test framework can find these by reading Postfix logs, so that should be straightforward.
But any tips how to configure Postfix to dump outgoing emails to file(s) instead of sending? Perhaps I need another piece of software working with Postfix to do this?
Even just a general outline would be a great help. I can probably figure out the details.
Thanks :)