- last update
over 1 year ago 59 pass - Status changed to Needs review
about 1 year ago 4:18pm 5 October 2023 - last update
about 1 year ago 60 pass - last update
about 1 year ago 60 pass -
AdamPS β
committed c167d46f on 4.x
Issue #3012160 by AdamPS, tostinni: Invalid unsubscribe link for test
-
AdamPS β
committed c167d46f on 4.x
- Status changed to Fixed
about 1 year ago 6:01pm 5 October 2023 - Status changed to Active
about 1 year ago 4:22pm 20 October 2023 - π¨π¦Canada yang_yi_cn
The "fix" seems to be breaking it again...
The website encountered an unexpected error. Please try again later. InvalidArgumentException: The user-entered string '[simplenews-subscriber:unsubscribe-url]' must begin with a '/', '?', or '#'. in Drupal\Core\Url::fromUserInput() (line 216 of core/lib/Drupal/Core/Url.php). Drupal\mimemail\Utility\MimeMailFormatHelper::mimeMailUrl('[simplenews-subscriber:unsubscribe-url]') (Line: 207) Drupal\mimemail\Utility\MimeMailFormatHelper::Drupal\mimemail\Utility\{closure}(Array) preg_replace_callback('/(<a>]+href=")([^"]*)/mi', Object, ' Mime Mail message template
- π¨π¦Canada yang_yi_cn
Ok I guess this is somewhat a documentation (or maybe adding to description so it could be a "Coding") issue.
Basically, this ticket is about "Invalid unsubscribe link for TEST", which is the NodeTabForm at a newsletter node > newsletter tab, where you can send test emails to preview, without actually sending the email to the whole list, very useful feature.
The NodeTabForm.php load the "current user email" as the DEFAULT e-mail (this is important),
then does some validation to ensure all emails are valid emails,
then eventually calls$this->mailer->sendTest(...
where the Mailer.php does the test sends. However, during the test send, it checkes if the emails are actually subscribers or not. IF THE EMAIL IS NOT A SUBSCRIBER, IT PASSES EMPTY SUBSCRIBER TO THE EMAIL BUILDER.
It all makes sense but now
- if the current user doing the test is not a subscriber to the newsletter
- when email subscriber is empty, the [simplenews-subscriber:unsubscribe-url] token replacement is skipped, so the token is still there in the body text.
- MimeMail does a check on all links and found
- WSODI think for the bare minimal, we need to add this info after the test email description "A comma-separated list of email addresses.", so it becomes:
"A comma-separated list of email addresses. The e-mails MUST BE SUBSCRIBERS OF THE NEWSLETTER, or the unsubscribe URL might cause the sending to fail."Or ideally we validate those emails are actually subsribers when submitting the NodeTabForm, and if they are not subscribers, show an validation error.
- last update
about 1 year ago 61 pass - @yang_yi_cn opened merge request.
- Status changed to Fixed
about 1 year ago 9:17am 21 October 2023 - π¬π§United Kingdom adamps
For me it works perfectly to send a test email to a non-subscriber.
Please check your simplenews-newsletter-body.html.twig template. You should have something like below. This means the unsubscribe link is skipped for a non-subscriber.
{% if unsubscribe_text %} <a href="[simplenews-subscriber:unsubscribe-url]">{{ unsubscribe_text }}</a> {% endif %}
If you still have problems then please open a new issue. This fix for this one has been released and it will cause confusion if we use the same issue again.
MimeMail is no longer a supported Mail plug-in. If gives WSOD for
<a href="[simplenews-subscriber:unsubscribe-url]">
then I'd say that's a bug. Automatically closed - issue fixed for 2 weeks with no activity.