Skip to content

docs: Update Email link validation note for allowed schemes and anchor links#837

Draft
promptless-for-oss wants to merge 1 commit into
mautic:7.2from
Promptless:promptless/email-link-scheme-validation-7.2
Draft

docs: Update Email link validation note for allowed schemes and anchor links#837
promptless-for-oss wants to merge 1 commit into
mautic:7.2from
Promptless:promptless/email-link-scheme-validation-7.2

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Open this suggestion in Promptless to view citations and reasoning process

Updates the 'Link validation' note in channels/emails.rst so it matches the broadened save-time Email link validation from mautic/mautic PR #16508. The note now says a link is valid when its href uses any scheme (such as http://, https://, mailto:, or tel:), is an anchor link starting with #, or is a Mautic token — replacing the earlier, now-inaccurate wording that only allowed absolute http(s) URLs, mailto:, or tokens. Also notes that the validation error now appears beneath the editor. Targets the 7.2 branch (mautic/mautic 7.x).

Trigger Events


Tip: Tag @Promptless in a GitHub issue to turn it into a documentation update 🐙

Mautic PR #16508 broadens save-time Email link validation to accept any
scheme-prefixed link (such as tel: and mailto:) and anchor links starting
with #, and surfaces the validation error beneath the editor. Update the
'Link validation' note in emails.rst to match.
Comment thread docs/channels/emails.rst
.. vale off

When you save an Email, Mautic checks every link it contains. If a link contains a malformed ``href``, such as ``://example.com``, Mautic blocks the save and shows an error such as 'The email contains an invalid URL: ://example.com'. This stops broken links from going out and disrupting email delivery. To save the Email, fix the link so its ``href`` is a valid, absolute URL that starts with ``http://`` or ``https://``, a ``mailto:`` link, or a Mautic token such as ``{unsubscribe_url}``.
When you save an Email, Mautic checks every link it contains. If a link's ``href`` is malformed - for example ``://example.com``, which has no scheme - Mautic blocks the save and shows an error beneath the editor, such as 'The email contains an invalid URL: ://example.com'. This prevents broken links from going out and disrupting email delivery. A link is valid when its ``href`` uses a scheme such as ``http://``, ``https://``, ``mailto:``, or ``tel:``, is an anchor link that starts with ``#``, or is a Mautic token such as ``{unsubscribe_url}``. Fix any flagged link, then save the Email again.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broadened the list of valid link forms per PR #16508. Its new hasValidScheme() method in ValidEmailLinksValidator.php accepts any URL beginning with # or with a non-empty scheme returned by parse_url(..., PHP_URL_SCHEME), so tel:, mailto:, and anchor links now save; the earlier note only allowed absolute http(s):// URLs, mailto:, or tokens. The Email/form.html.twig change surfaces the 'invalid URL' error beneath the editor, which is why the note says the error appears beneath the editor.

Source: mautic/mautic#16508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants