Syntax error sending emails with Lua and Gmail

Got a fairly unhelpful error while trying to send an emailĀ using LuaSec and LuaSocket to connect to googles SMTPĀ servers:

555 5.5.2 Syntax error. uc3sm9880237wib.2

Turns out google doesn’t like the recipient format

‘FirstName LastName <name@example.com>’

and instead prefers just

‘<name@example.com>’