sendgrid icon indicating copy to clipboard operation
sendgrid copied to clipboard

Use pretty JSON to reduce risk of going over 1k character per line limit

Open diazruy opened this issue 8 years ago • 1 comments

According to [Sendgrid's SMTP API documentation]( https://sendgrid.com/docs/API_Reference/SMTP_API/using_the_smtp_api.html

-Requirements-and-Limitations), all lines in a header must be under

1,000 characters. By using JSON.pretty_generate, arrays (e.g. multiple recipients and substitutions) will be wrapped, reducing the likelihood of exceeding this limit, with the exception being if some element in an array is itself over 1,000 characters long.

diazruy avatar Mar 16 '16 22:03 diazruy

I have now found out that ActionMailer takes care of wrapping lines, which must be why you had the gsub to add the spaces. Still, using pretty_generate could make that a bit clearer.

diazruy avatar Mar 17 '16 03:03 diazruy