Changing Message Variables to Match Drupal Defaults

Created on 29 June 2024, 14 days ago
Updated 10 July 2024, 2 days ago

Hello, I'm using this module on a Drupal 10 site. And on the 'Mailer policy' page at Contact form Β» Message Β» *All*, I've modified the content slightly to more closely match the Default contact form's notification message:

<p>{{ sender_name }} ({{ sender_url }}) sent a message using the contact form at {{ form_url }}.</p>
<hr>
{{ body }}

This gets me pretty close, but there are 2 improvements I'd really like to make and can't figure out how.

#1. In the default contact form, the message shows the sender's e-mail address more clearly (and simply). For example, it looks like this:
Rob Roberts (not verified) (name@outlook.com) sent a message ...

However, with the above variables in place, the Symfony message looks like this:
Rob Roberts (not verified) (mailto:name@outlook.com) sent a message ...

I just want this to be clean and simple, and *not* show the "mailto" part since that is obvious and unnecessarily cluttered looking.

#2. At the end of the message, the default Drupal message text looks like this:
... using the contact form at https://www.domain.com/contact.

However, the Symfony version looks like this:
... using the contact form at /contact.

In this case, it would be preferable to show the entire URL since it's more informative and looks better as well

I have scoured Google, the "contact.module" file, and aside from the linked related issues I'm not finding anything of use. I appreciate that the work on these issues is complex, so in the meantime it'd be great if someone could enlighten me on how to do these 2 things:

  1. Change {{ sender_url }} to the desired variable
  2. Change {{ form_url }} to the desired variable

Since this is how the default Drupal text looks, I know it must be possible! Any help to make these small-yet-important (to me) changes would be much appreciated.

πŸ’¬ Support request
Status

Active

Version

1.4

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States jimmb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jimmb
  • πŸ‡ΊπŸ‡ΈUnited States jimmb
  • πŸ‡¬πŸ‡§United Kingdom AdamPS

    #1 is probably a bug. It comes from ContactEmailBuilderBase.php line 30 which adds in the mailto: . I don't really know whyπŸ˜ƒ.

    #2 should be corrected by "URL to absolute" in your All/All email policy. Maybe you removed it by mistake?

  • πŸ‡ΊπŸ‡ΈUnited States jimmb

    Thanks very much for the reply. And in light of this, then it looks like there may be 2 bugs ...

    For #1, it's good to at least know the likely cause of this. It's obviously not essential, but would be nice someday if this just showed the e-mail address like the default Drupal setup.

    For #2, I double checked and 'URL to absolute' is there. I've attached a screenshot from /admin/config/system/mailer, which shows that it's active. As such, I'm guessing that is a bug as well.

    Any ideas to troubleshoot this would be much appreciated. And naturally if you can fix either or both of these bugs, that would be fantastic!

Production build 0.69.0 2024