Rails links in mailer are invalid (Liquid gem)

550 views Asked by At

There are template witch are written by admins. And in mail there possibility to enter link (not the rails way). There is editing menu, what generates following, basic html code:

<a href=" {{ user.owner_name }}" target="_blank">company’s profile</a>
  • where user.owner_name - domain.com/user/user_name

I don't talk about localhost because it possible will not work. So I'm talking about production server.

I receive email, with broken link (if I click on it - it's not opening) but if copy link:

x-webdoc://73A3A2DC-F22E-4558-8853-C6A57985EE7C/mydomaine.com/user/

Why this appears?

EDIT

It seems it's realeted to MacOs. It prbolem appears when I view letter thorought Mail App, or Safari browser.

Now, I need any advise how to avoide this prob.

1

There are 1 answers

0
spickermann On BEST ANSWER

I would argue that example.com/user/user_name is not a useful URI in the context of an email, because it is missing a protocol (like: http://example.com/user/user_name). Without the protocol it could be misunderstood as a relative URL, which may lead to security issues or at least is useless in the context of an email client.

From that point of view, it is not surprising to me that some email clients or web mailers are trying to be smart and protect the user by annotating the URL in some way.

In this example the added x-webdoc: indicates that the user has to make the decision on what application to use to open that link because without a proper protocol it is not obvious what application will be able to handle the URI. See What is x-webdoc?