Variable in href in an email button

Your software
My Mautic version is: v4.4.6
My PHP version is: 8.0.27
My Database type and version is: 10.5.19-MariaDB-0+deb11u2

Your problem
My problem is:
I am trying to use a variable in a href of a button, but it just redirects me to a 404.

The way I was doing the integration is as follows:
GET DETAILS

The button has to have the url that is sent from the form as a custom field to send it to a specific url, the data arrives to mautic correctly, the variables in the mail work fine, the problem is the variable in the href.

I attach screenshots.

Can you go to the code and check if the link is properly saved (url encoding fine, no spaces)

The data I get from the form arrives well to Mautic, in the email code that should reach the customer after filling out the form is the one that has the problem that the variable does not take the value of the url and sends to a 404.



What happens if you url encode the link itself?

The data arrives well from the form as attached above, the problem is in the variable inserted in the href of the <a> tag of the mail that I send as a response after filling out the form, mautic removes the variable and redirects to an internal URL 404 or if I put the variable in a <p> tag shows it only as text, it means that the variable is displayed, only in the href does not work and is not clickable.


All urls are replaced by mautic urls

We have it working currently, where we set the URL as a fixed part and only add the variable as a parameter:

https://REDACTED-MAUTIC-URL/whatever?email={contactfield=email}

This worked fine.

but when I put the url as a variable in href it works for you ? or is it some server side configuration that is giving me problems ?

Also do the test by passing a URL type variable to the href or only a text type variable only with the part of the search that I want it to redirect to leaving the rest of the URL defined, but it still doesn’t work, mautic changes those URLs to those of the domain and redirecting to a 404 as you said above.

Here are some examples of how I’m implementing it:
<a style="text-decoration: none; margin: 0;" href="{contactfield=support_general_href}"><span style="color: #c71618;">GET DETAILS <br></span></a>

This one here has been tried with the development URL or with a production URL, so they are validated URLs:
<a style="text-decoration: none; margin: 0;" href="http://domain-sandbox.s3-website.us-east-2.amazonaws.com/EN/general_support.html?message={contactfield=general_support}"><span style="color: #c71618 ;">GET DETAILS <br/></span></a>

This is how it works, it displays the variable, in this case the URL, but it’s not clickable, it just displays as text.
<p>url: {contactfield=support_general_href}</p>