There's a website I use all the time where the log-in mechanism involves sending a code to my e-mail address.
Anyone know of a simple way to write a script that retrieves that code? I can set up a custom e-mail address on any free provider and have all these "log-in" e-mails automatically forwarded to that. Is the best way to use something like `imaplib`?
@pganssle Correct. And coding up a basic SMTP receiver is actually surprisingly easy. Parsing the email for the code would be more challenging.
@pganssle SMTP is just a text protocol over TCP. So, use whatever socket library you're comfortable with and then look up the SMTP spec. Most likely, for your use case, you can ignore all the stuff about attachments and just accept basic messages and parse their contents.
Like, the first message you have to accept is a four-char "HELO". That kind of simple.
The biggest problem you're likely to run into is many messages are encrypted into Base64, but even then, there are a ton of libraries to decode it.