We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28262
    • 3 Posts
    This is an auto-generated support/comment thread for ObfuscateEmail.

    Use this forum to post any comments about this addition or any questions you have regarding its use.

    Brief Description:
    Automatically encodes RFC822 (almost) email addresses and "mailto:" (both inside and outside href attribute) with a random combination of raw, decimal, and hexadecimal entities.
      • 25663 MODX Staff
      • 12,272 Posts
      Definitely works as advertised... very cool job and thanks. I previously ran into trouble with mailto links but not any longer! Wonderful stuff. smiley
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 24495
        • 407 Posts
        Don’t tried this until now therefore my question: what about enhancements like pre-defined subjects?
        mailto:anybod<@anywhere.com?subject=foo
        and subjects containing multiple words with blanks?
          • 25663 MODX Staff
          • 12,272 Posts
          That’s what I tried and it works great.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 24495
            • 407 Posts
            Works great, thanks! Multiple words with blanks must be written with a %20 instead of a blank.
            mailto:[email protected]?subject=foo%20bar
            Otherwise the encoding ends at this blank. (Email set with TinyMCE and iso-8859-1)

            An other workaround is setting the email link (with blanks), saving the page, re-calling the "edit page" with a call of link editing (without changes) and saving the page second time. Then TinyMCE changes the blank to %20 itself.
              • 25663 MODX Staff
              • 12,272 Posts
              I don’t think i had to do anything to get the encoding to work when using a subject with blanks, other than have blanks. Then again, this was in my template and bypassed using TinyMCE.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Three guesses what this puppy does to a stylesheet include...
                <style type="text/css">
                @import url("[(base_url)]assets/templates/mytemplate/whatever.css");
                ...
                </style>
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  It looks like a pretty simple fix, for anybody who is more regex savvy than I am; the regex needs to specify one or more characters before the @.

                  I think these are the relevant lines:
                    $atom = "[-!#$%&'*+/=?^_`{|}~0-9A-Za-z]*";
                    $email_half = $atom . '(?:\\.' . $atom . ')*';
                    $email = $email_half . '@' . $email_half;
                    $email_regex = '<(' . $email . ')>';
                    return $email_regex;
                  


                  Or maybe just a basic email validation regexp line before the value is returned?
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 25663 MODX Staff
                    • 12,272 Posts
                    The RFC spec allows for some interesting things, including emails in the form of "ryan@office"@collabpad.com ... some interesting regex ensues...
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 28262
                      • 3 Posts
                      Quote from: rthrash at Apr 15, 2007, 02:10 PM

                      The RFC spec allows for some interesting things, including emails in the form of "ryan@office"@collabpad.com ... some interesting regex ensues...

                      Yes but the use of quoted strings in an email address is rare. So I will not include support for such e-mail addresses unless somebody really needs it.

                      Quote from: sottwell at Apr 15, 2007, 01:03 AM

                      It looks like a pretty simple fix, for anybody who is more regex savvy than I am; the regex needs to specify one or more characters before the @.

                      I think I found the bug. Change
                      $atom = "[-!#$%&'*+/=?^_`{|}~0-9A-Za-z]*";

                      to
                      $atom = "[-!#$%&'*+/=?^_`{|}~0-9A-Za-z]+";

                      (The last ’*’ should be a ’+’, so that empty strings do not match.)

                      Will test it and upload an update soon.