Encode/decode SMTP AUTH username/passwords

When using SMTP AUTH, the username and password are base64 encoded. Here’s a snip of perl that will encode a string:

perl -MMIME::Base64 -e 'print encode_base64("username");'

This will produce something like this:

dXNlcm5hbWU=

And here’s the decode:

perl -MMIME::Base64 -e 'print decode_base64("dXNlcm5hbWU=");'

which of course yields:

username
  • Super Double A

    Something tells me that second one should use the decode_base64 function. You should try your “solutions” before putting them on the Internet.

  • http://reliablepenguin.com Lee Blakely

    Thanks for the correction.

blog comments powered by Disqus