mailto-URL in Button

Hello everyone,
I would like to add a button using the editor. I can also provide it with a link. However, I would have liked to use this to generate an email with a subject. If I enter “mailto:max.muster@domain.de?subject=Test” as the URL-String, I get the error message “There’s an error on the “URL” field in block 3 using the “Button” block type” when saving.

What can I do?

Such URI schemes are not supported in a URL field (only http(s) and ftp urls), you would have to use a text field or a custom field for your custom button block type.

The regex for url field validation is:

$regex = '_^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:localhost)|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$_iu';