In a html message body appears the following link: <a href="http://exampledomain.com/user/login?destination=comment/5536%23comment-5536">example link</a>

Why the %23 there? Well, I discovered that if you use # instead, then Drupal will strip the anchor and the user will have to scroll down to find the comment.

The problem I have is that apparently Mimemail converts the %23 to # so I have no way to send this link correctly in an html mail. The plaintext version of this link is left untouched and I wish the same would be for the html version.

Is there a work around for this? Is there way to switch off this unwanted conversion? Or am I mistaken and should I look somewhere else for the cause?

Comments

mforbes’s picture

Your approach to the link makes sense, and it's actually not that Drupal would strip it, but that the value of php's $_GET['destination'] during the login form would end up incomplete: the # marks the end of the query string and the start of the fragment string, and $_GET is only the query string (in fact, the browser never transmits the fragment string to the server). By having %23 instead, it's not a fragment from the browser's point of view, it's part of the query string and thus transmitted and then saved into $_GET['destination'] (and php decodes it back to a # along the way) as desired.

So, having the encoded character in your href definitely makes sense and mimemail should not be decoding it when making the html part.