When i work with the email stuff, i accidentally found problem when email template was already sent by Mandrill SMTP. For example in my apps there is a feature to reset password, which is of course inside the email contains reset password link.

For securing the reset password link it must supply a params called reset_password_token. The problem found when the reset password link doesnt work, because its always wrong redirect. Can you spot the problem ?.

Accidentally the links params contains extra \n. This kind of issue with html frameworks that generate HTML with no true line breaks. Based on rfc5321 Text Line its state :

The maximum total length of a text line including the is 1000 octets (not counting the leading dot duplicated for transparency).

Hell yeah because i’m using SLIM for mailer template, in production SLIM compiles as a single-line by default pretty: false for optimization. We can solve it by toggle the pretty option to true, see slim config.

But this kind of solution will be sacrifice to other page except the mailer template not being optimized. Instead using slim for mailer template, just use ERB so it will break every new line.

Blog Logo

Agung Prasetyo



devblog of @sgt_mactavish

Back to Overview