0

I work with a dozen pieces of equipment whose operating software has the option to send e-mails on error. I would prefer to capture the details of that e-mail on the host PCs that run them (i.e. for logging, communicating details automatically via Slack, etc.) rather than them going to an inbox somewhere.

Is there a way to have the software e-mail an address that is essentially a lightweight piece of code running on the same PC mimicking something like an SMTP server (that will allow me to get after the message's contents)? Other solutions I have seen are along the lines of setting up a full-blown server which seems like overkill.

mag
  • 23
  • 2

1 Answers1

0

You may configure SmtpClient to save email to a specific folder instead of sending it over the wire. Check this answer.

Also you must design your system in the way it could work with different implementations of your 'sender', so that you can replace it when you need that, for example during testing. In this case you can easily provide proxy implementation that will capture email content and then send it to localhost, or add aspects (make retries, logs performance...).

fenixil
  • 2,106
  • 7
  • 13
  • Unfortunately I have limited control over the client - the software in question only has fields for the recipient address and SMTP server address. Ideally I would specify "localhost" or a similar recipient address that would actually be some code that would then save the e-mail contents. – mag Dec 10 '19 at 14:36
  • Why is the question with c# tag? Is this .Net app sending emails? Do you have access to sources/can edit them? Did you consider to change its config? – fenixil Dec 11 '19 at 05:12