jstedfast / MailKit

A cross-platform .NET library for IMAP, POP3, and SMTP.
http://www.mimekit.net
MIT License
6.04k stars 809 forks source link

Question: Logging EHLO Response in DB #1727

Closed imukai closed 3 months ago

imukai commented 4 months ago

My app connects to a bank of a couple dozen load-balanced SMTP servers. Their response to EHLO contains info about which server is handling the request.

ProtoLogger does a good job of saving that whole conversation to a file but I am interested in capturing just the EHLO response to save into a DB.

Is there an event I can hook into and obtain that response without parsing the file that Proto creates?

Thank you for maintaining this thing all these years.

jstedfast commented 4 months ago

There currently isn't anything that you can hook into. I wasn't anticipating anyone ever needing that.

jstedfast commented 3 months ago

I've been thinking this over for the past few days. I question the usefulness of having an event or some other mechanism for reporting the EHLO response seeing as how it doesn't seem to have any value outside of your specific use-case.

For now, my recommendation is to implement your own IProtocolLogger and scan for an "EHLO" command in the LogClient() method implementation and then extract the response in the following call(s) to LogServer().