This article is intended for software developers or those interested in the code behind GMass.
GMass is written mostly in C# and JavaScript, and the C# backend makes heavy use of a popular email parsing component called MimeKit. In face, MimeKit, has become so popular that Microsoft is now recommending that developers use it as the standard instead of Microsoft’s own SmtpClient library.
Over the weekend, we updated some of the software components that GMass is built on in preparation for a big feature launch, and in doing so, we updated MimeKit from version 1.12 to the latest release 1.18. That upgrade unfortunately broke some of our email address validation code, and many users saw a “token offset” error as a result.
Here’s what happened. Previously, in version 1.12, the following scenarios would pass without throwing an exception:
After updating to version 1.18, the top two of the three scenarios do throw an exception:
The impact on GMass is such that if you’re connecting to a Google Sheets spreadsheet, and your column containing email addresses has a bad data value that is an invalid email address, such as “[email protected];[email protected]”, whereas before our code would handle this appropriately and eventually filter the bad entry out, now all of a sudden, our code was throwing an exception.
Making matters more complex was that the MimeKit TryParse didn’t always catch a string that could not be converted into a MimeKit.MailboxAddress object. For example:
In the above samples, TryParse returns false for “[email protected];[email protected]” but returns true for “test<[email protected]>”. It returns true for the latter because it assumes that the part outside the angle brackets is the Name, and so Name=test and [email protected]. Our code though attempts to create a MailboxAddress object from the whole string, and in this case, the parse into Name and Address doesn’t happen, as the constructor assumes that the entire string represents just the Address portion of the object.
We did check the Release Notes for MimeKit before deploying the update, but there was nothing indicating the change in email parsing rules. Still however, we are eternally grateful to Jeffrey Stedfast for building and maintaining the MimeKit library for the .NET framework. Without it, my job as a software developer parsing and assembling email messages would be far more difficult.
Only GMass packs every email app into one tool — and brings it all into Gmail for you. Better emails. Tons of power. Easy to use.
TRY GMASS FOR FREE
Download Chrome extension - 30 second install!
No credit card required
Did you submit an issue to the project for this?