Hi,

In the newsletter template that I'm using there is an unsubscribe link that is using the token [newsletter:unsubscribe_url]. But it seems this token generates a relative url in the email, i.e. only the part after the domain.

Which makes the link in the mail look like this:

http://newsletter/unsubscribe/6Ku6wDuF-Lj3ZaXIs1he2bAHAxJ-uWDl1fPG8JETXw...

Please note that there is no domain after http, and this link will of course not work. How do I resolve this? I suppose adding the domain before the token in the template will only result in a link like this: http://mydomain.com/http://newsletter/unsubscribe/...

Comments

robbertnl’s picture

Same issue here. This also applies to urls for nodes, all relative.
For now i did a quick & dirty fix:
Node urls fix: http://[current-domain:hostname]/[node:url]" (node:url:absolute is NOT working)
Unsubscribe url: the above solution didnt work, i hardcoded the urls in the module at line 677 by replacing the url-function.

robbertnl’s picture

My above quickfix doesn't work very well.
For me the problem is caused by Pathologic module, i had `Correct URLs with Pathologic` enabled and set to `Path relative to server root (/foo/bar) ` for the full_html input format. Which is preferable for normal links in pages (e.g. created with linkit module). So i dont want to disable this filter. Instead I created a new input format and i did a hack in the newsletter.module forcing to use my new input format. I changed line 771 to:

<?php
$message['body_format'] = 'full_html_for_news';
?>

Used the same settings compared to full_html but with absolute urls in Pathologic.
It would be better if it was possible to set an input format in the newsletter module or did i miss that setting?

ParisLiakos’s picture

Category: bug » support

You can change the text format in the template

robbertnl’s picture

Oops, my bad. Thank you. I removed the text format dropdown from ALL forms in the past, to make the forms easyer to understand for the customer. Not handy for this form now.
Changed and fixed for me now. (Solution: no need for hacks, just use the module, create a new text format with pathologic set to absolute urls, set the newsletter template to use that text format)

Perhaps also for the topic starter?