Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've tried various filters and I like Invisimail, yet I'm missing an important feature.
It doesn't obfuscate mailto links with arguments;
mailto:info@mydomain.com?subject=Hello&body=Dear,&cc=copy@info@mydomain.com
Not good at regular expressions else I would have looked into it myself :(
Cheers
Comment | File | Size | Author |
---|---|---|---|
#15 | support-mailto-arguments-572356-15.patch | 1.03 KB | c.nish2k3 |
#9 | support-mailto-arguments-572356-9.patch | 1.19 KB | pjcdawkins |
#7 | support-mailto-arguments-572356-6.patch | 1.29 KB | dude4linux |
Comments
Comment #1
Crell CreditAttribution: Crell commentedHm. Yeah, that doesn't work. My regex-fu is almost nil, so I probably wouldn't be able to add that myself either. However, I'd accept a patch that does so.
Comment #2
dude4linux CreditAttribution: dude4linux commented@Bartezz Do you need to obfuscate the subject and body, or just the e-mail addresses? Might be simpler to do just the latter. I discovered this problem while testing Invisimail using CKEditor to insert the mailto: link. It works as long as the subject and body fields are left blank. I took a look at the code but couldn't figure out where the presence of a '?' would cause the regex match to fail.
Comment #3
Bartezz CreditAttribution: Bartezz commentedNah I think only email address obfuscation would suffice don't you think? Though what to do with cc= or bcc=
Cheers
Comment #4
dude4linux CreditAttribution: dude4linux commentedI figure it has to be one of the special characters in the extended mailto: that is causing the regex to fail, i.e. either ?, &, or =. I tried
and the result was
so I think it must be either the ? or =.
Note: I'm looking at the 6.x version, not the 7.x that this issue belongs to.
Comment #5
Bartezz CreditAttribution: Bartezz commentedThe original issue by me was in 6.x, Crell changed it to 7.x
My 'regex-fu' also is not legendary... can't really say where the prob lies..
Comment #6
dude4linux CreditAttribution: dude4linux commentedThe three regex patterns used by Invisimail assume that the href mailto: address is delimited by quotes ['\"]. I tried adding a '?' to the closing delimiters, i.e. ['\"\?] and it appears to work. By some stroke of luck, the &cc= also works. I presume &bcc works as well, but I didn't test it. I haven't checked the javascript option yet, but will do that next.
Test Results:
I haven't rolled a patch in some time, but if the author thinks it's necessary, I'll give it a try.
Comment #7
dude4linux CreditAttribution: dude4linux commentedDecided it was time I learned how to use git to prepare a patch, so here is my first attempt. This patch contains just the mods discussed above in #6.
Comment #8
Crell CreditAttribution: Crell commentedSince I don't understand the regexes here in the slightest, we will need unit tests for the regexes at least. (The D7 version of the module doesn't have tests yet, but it should be very easy to write tests for it; they can even be UnitTestCase tests, not WebTestCase tests, so that they run in less than an hour.)
Also, this would be for Drupal 7 only. The Drupal 6 version is not taking any new features as the D7 version is a total rewrite.
Comment #9
pjcdawkins CreditAttribution: pjcdawkins commentedI've re-rolled the patch in #7, so it applies to the latest -dev and 1.1 release, because it seems useful. And I've tested it, but manually...
Comment #10
cerr CreditAttribution: cerr commentedHi,
I just installed invisimail and it works great except, I still doesn't let em specify the subject. I'm using CKEditor and if i specify the subject, this happens:
and like this without the java script:
Comment #11
indigoxela CreditAttribution: indigoxela commentedI've applied patch #9 to current stable release 7.x-1.2 and can confirm that it works with email arguments (subject and body).
I'm using filter "Encode email addresses: Javascript-wrapped HTML entities".
Filter "Encode email addresses: HTML entities" is also working fine.
Note: it is absolutely important, that invisimail is the last filter in list.
Comment #12
pjcdawkins CreditAttribution: pjcdawkins as a volunteer commentedComment #13
Ouach CreditAttribution: Ouach commentedThe patch #9 worked for me.
Thanks.
Comment #14
MustangGB CreditAttribution: MustangGB commented#9 is not a full re-roll of #7, there are 4 instances that need changing, however #9 only updates 3 of them.
However the missing instance is in $pattern which isn't used anywhere, so I'd say either:
a) Update the missing instance
Or
b) Just remove $pattern altogether
Comment #15
c.nish2k3 CreditAttribution: c.nish2k3 as a volunteer commented$pattern is not used. So better to remove it.
Comment #16
MustangGB CreditAttribution: MustangGB commentedGreat thanks, looks good and works fine.
Comment #17
TomC CreditAttribution: TomC commentedVersion 7.x-1.2 appears to have missed out the patch which allows arguments. Checked the code and the $patterns are:
$pattern = "@(?:(]*href=['\"](mailto:$mail)['\"][^>]*>)?((?".">(?]*href=['\"](mailto:$mail)['\"][^>]*>(.*?))@$modifiers";
$pattern_diff_link_text = "@(]*href=['\"](mailto:$mail)['\"][^>]*>(.*?))@$modifiers";
$pattern_same_link_text = "@(?:(]*href=['\"](mailto:$mail)['\"][^>]*>)?((?".">(?
$pattern (e.g.) should read ... href=['\"](mailto:$mail)['\"\?]... etc I believe.
Comment #18
solideogloria CreditAttribution: solideogloria commentedI was going to make the comment above readable, but never mind.