Allow personalised 'view in browser' links for mass emails
Problem summary: As a user, I want to view an email in my browser, but when I do the tokens are not populated.
Detail: The {mailing.viewUrl} token can be used to generate a link to the 'public' view of an email. If a user is logged in to the website, then the tokens in the email are replaced correctly. However, it would be cool if the public view of the email also supported checksums, so that we can include a link to the personalised web-version of the email.
This involves:
- Supporting checksums when rendering the email in \CRM_Mailing_Page_View::run
- Adding a new token to extract the 'mailing key' (ID or hash) from the mailing
- Updating the documentation to describe the URL format to use for this
The proposed format is: https://example.com/civicrm/mailing/view?reset=1&id={mailing.key}&cid={contact.contact_id}&{contact.checksum}
This is because we can't easily 'inject' contact-related tokens into the existing {mailing.viewUrl}. This format also matches the existing patterns as described in https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/
(It would be super-awesome if we could make these tokens more user-friendly, like {checksum.event.123} or something. But that is out-of-scope for this issue!)
I'm about to throw up a PR with the proposed code changes.