I was working on a project that tried to re-skin the Mailchimp email preferences center.
Unlike the Mailchimp signup form this page is a lot harder because you need to know the users information. Thankfully this is fairly easily done with some merge tags to make the correct links in the eDM (email) and the Mailchimp PHP SDK.
The time consuming bit turned out to be outputting the users email address in the same obfuscated way that Mailchimp does. It hides enough of the email address to prevent spammers and nefarious people from stealing the address, whilst ensuring that you (and it) know that you are talking about the correct email address.
The technique I used to create this function is not the most efficient. In fact it’s probably the least efficient, but was highly agile and easy for me to understand whilst writing.
It takes an email address like firstname.lastname@example.org and turns it into t***@s**********.com
The PHP function should be visible in the gist below, otherwise check it out on Github.