It's fairly common in newsletters to have an initial table of contents with anchor links to the articles below:
In This Newsletter ...
<a href="#1">What's New</a>
<a href="#2">Breaking News</a>
..etc
now the body of the email ...
<h2 id="1">What's New</h2><br>
... some text here ...
<h2 id="2">Breaking News</h2><br>
... some text here ...
When I do this using SimpleNews / MimeMail, the links in the test email get my site $URL (http://lifetwo.com/production) prepended to them so that the first anchor link, for example, is no longer "#1" but "http://lifetwo.com/production/#1." Of course, that's not what we want -- we want the user to click on the #1 anchor and jump down to that section of the email, not get linked back to the site. It's also a nonexistent URL.
Although I'm composing and sending the test newsletter in html mode, I can see that the same problem exists for the plaintext links.
On the actual node page for the newsletter, the link is fully formed and behaves correctly -- clicking on it jumps you down the page to the appropriate anchor.
If this is an issue w/ MimeMail or some other module, please let me know and I'll cross post there. I thought SimpleNews was the most likely suspect since the change log indicated that work was done with internal links a while back.
thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | mimemail_jumplinks_update.patch | 522 bytes | jerdavis |
| #3 | mimemail.inc - don't convert jump links - 161600 - 3.patch | 853 bytes | jbjaaz |
Comments
Comment #1
jbjaaz commentedDid you ever figure out why this was happening? I'm having to deal with the same thing.
Comment #2
jbjaaz commentedAfter digging around, I found that the following code in mimemail.inc is the culprit
So, I get the idea. A newsletter might be sprinkled with links pointing back to your site and this would make the links work properly. I think its safe to assume though that if the anchor href is "#text", chances are it's not pointing back to the site.
Any ideas how to enhance the regex pattern to not catch "#text"?
Comment #3
jbjaaz commentedalright, I have a fix.
In mimemail.inc, look for the function "_mimemail_url($url)".
I added the following code prior to the return statement
Basically, I assume that a url with just the fragment is a jump link within the email. The reason I check that $path is empty is so that urls like "services#mytarget" are properly converted.
Comment #4
dman commentedThat looks like a good fix.
Yes, most embedded links in an email should be expected to be fully-justified.
But, purely anchor tags can probably be exempted.
Good idea.
Comment #5
jbjaaz commentedIt's such a simple fix.
Comment #6
sutharsan commentedjbjaaz, I can agree with you that it is a simple patch. However it is not good practice to set your own patches to RTBC when you are not the module (co-)maintainer. But you have overlooked the most important fact. That this patch is for mimemail and it is currently in simplenews issue queue. Therefore I transfer it.
I recommend that this bug get fixed. The patch looks Ok to me from reviewing the code. Not tested.
Comment #7
shiraz dindarThanks for catching this. Saved me some work.
Comment #8
jerdavisTested this patch and verified that it resolves the issue mentioned above. Patch applies successfully and behavior is as expected - this should be clear to commit.
Comment #9
jerdavisUploading an updates patch, this patch takes into account the "Code Cleanup" patch from: http://drupal.org/node/220432
This update requires that patch prior to being applied.
Comment #10
allie mickaCommitted to HEAD, will roll a D5 release soon. Thanks!
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.