Hi there.
I'm using the Simplenews and the HTMLMail modules to generate HTML newsletters and i couldn't get the replacement patterns to work.
I tried with the Mime module too but with no luck.
The only way i receive the right links on my email is when sending plain text newsletters otherwise it simply won't replace the patterns.
This is what happened to me with the several combinations of the modules and with the [simplenews-subscriber:unsubscribe-url] pattern (i only needed this one):
simplenews + htmlmail : replace with a empty string ""
simplenews + htmlmail + pathologic: the entire pattern maintains.
simplenews + mimemail : the entire pattern maintains.
simplenews plain text newsletter: the correct links are passed
I manage to solve my problem generating the hash myself on the message templates with the function simplenews_generate_hash:
simplenews_generate_hash( $params['context']['account']->mail, $params['context']['account']->snid, '2')
Comments
Comment #1
miro_dietikerreferring to pot. related:
#1173014: Simplenews links in confirmation emails doesn't work
Comment #2
einzelkind commented+1 same issue here
Comment #3
berdirWill need to investigate, from looking at the code this shouldn't happen.
Anyone else experiencing this?
Comment #4
berdirI've just written some tests which verify that html mails are being sent with the tokens replaced. There also haven't been any reports lately about this. Marking as fixed.
If you still experience this, please re-open and describe exact steps on how to reproduce, including what kind of tokens you are using.
Comment #6
inteja commentedIn my case (using Simplenews 6.x) it was/is Pathologic that was preventing token replacement in emails. See this Pathologic issue http://drupal.org/node/1421868
Comment #7
berdirThen why would you re-open this issue if it the problem was another module? :)
Comment #8
inteja commentedI didn't (and still don't) know where the fault lies i.e. with Simplenews or Pathologic. Sorry I should have worded my comment better as I implied it was a pathologic issue. In reality I don't know.
All I do know is that Pathologic seems to interact flawlessly with other modules, but not Simplenews and I read somewhere that (if I recall correctly) Simplenews, by design, does token replacement late, which may have something to do with Pathologic not being able to do token replacement with it. But that's just a guess.
Comment #9
pavel.karoukin commentedI was able to get around it by using hook_pathologic_alter() from latest dev version of Pathologic 7.x. I just added this into one of my custom modules:
This will skip any URL which matches [.+] pattern.
Comment #10
duaelfrThis only works for URLs containing only a token or starting and ending with a token.
<a href="[user:url]">My link</a>works<a href="/node/[node:nid]/edit">My link</a>does not workI am looking for a way to make this work natively in Pathologic.
Comment #11
duaelfrI found that it is the
urlfunction call within pathologic which encodes tokens, but no hook is available to avoid this behavior.Maybe we should add a condition if token is enabled which would decode tokens only but it seems a bit hacky.