Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deal with long links in HTML-emails

Tags:

php

html-email

I've searched the web on this and I can find two solutions:

  1. Use a URL-shortner.
  2. Use brackets < > to allow insertion of whitespace. This only applies to plain-text emails.

I'm sending HTML emails that contains sensitive information, like password recovery links and auto-authentication links. These secure links are, by their nature, quite long. Easily longer than 70 characters or whatever arbitrary limit is imposed on e-mail bodies.

Obviously I can't use any form of URL-shortning because it would circumvent any secure cryptography technique I've used for the links.

I suppose the largest issue is that the links aren't wrapped nicely by email clients. The nice word-wrapping is supported in CSS3 technique, so there is no way MS Outlook will ever support this.

How do I make it so the links are not visually disruptive and possibly easy to copy-paste in case of email client malfunction?

Example

If the link doesn't seem to work, try copy-pasting it to your browser: hxxp://development/#auth/YoxOntz0Oj0ExOiJfcmFuG9tbmVzcyI7czoxOTI6kJsYkV0qMGMuZ1pFZVQ5YkRQNDZPR200Unl60dGlpNlhZZC9QcEVeH0lvV2NVVlpWWFcwWlF0VjRyc0p4akYzclJ0GTkJmSlgxco0aEtDS0FuTlBVSXAxUVhCcGdRNGpHMVl5UGZMRFVacDVSQ1BqcU0tKYlNxZ0FqYXpjTkNqTS9LV29xSk4ydGtyeFpNdV0c2VLMERUbEYwc08xUWU5aXR0GOXl0bVFpcjlXeGZjUE100S0o1L1FcmQ4MmhOdm5LUSI7fQ

Additional notes:

I do not want my links to expire. If I want them to expire at all I'd have a time frame of months, not hours. These links are not just password recovery links.

like image 907
Halcyon Avatar asked Sep 12 '12 10:09

Halcyon


1 Answers

Have you tried the Microsoft proprietary word-break:break-all; ?

<td style=“word-break:break-all;”>

This worked best for me (best compatibility across vendors):

<p style="word-break:break-all;">
    <font style="word-break:break-all;">hxxp://really_long_link</font>
</p>

Tested on: MS Office 2007/2010, outlook.com, hotmail.com, gmail.com, yahoo.com (yahoo did not display nicely)


While this was edited to include <p>...</p> I would highly discourage the use of paragraph tags in HTML email if spacing is impotant since email clients interpret these differently.

like image 95
samanthasquared Avatar answered Oct 19 '22 05:10

samanthasquared