htmltest icon indicating copy to clipboard operation
htmltest copied to clipboard

mailto with plus sign incorrect marked as invalid

Open theory opened this issue 4 years ago • 4 comments

Describe the bug

On this page, I have a mailto: link like this:

<a href="mailto:[email protected]">subscribe by email</a>

Running htmltest (just installed via go install) it reports:

  invalid email address (invalid format): 'sqitch-users [email protected]' --- 2013/06/sqitch-list/index.html --> mailto:[email protected]

I think this is incorrect: isn't the plus sign valid there, and not representing a space. I tried pasting it into mailtolinkgenerator.com and it also output it with a plus. Looking at rfc6068, there's this table:

      mailtoURI    = "mailto:" [ to ] [ hfields ]
      to           = addr-spec *("," addr-spec )
      hfields      = "?" hfield *( "&" hfield )
      hfield       = hfname "=" hfvalue
      hfname       = *qchar
      hfvalue      = *qchar
      addr-spec    = local-part "@" domain
      local-part   = dot-atom-text / quoted-string
      domain       = dot-atom-text / "[" *dtext-no-obs "]"
      dtext-no-obs = %d33-90 / ; Printable US-ASCII
                     %d94-126  ; characters not including
                               ; "[", "]", or "\"
      qchar        = unreserved / pct-encoded / some-delims
      some-delims  = "!" / "$" / "'" / "(" / ")" / "*"
                   / "+" / "," / ";" / ":" / "@"

If I'm reading it right, the dot-atom-text bit (documented in rfc5322 appears to allow + signs in the local-part:

   atext           =   ALPHA / DIGIT /    ; Printable US-ASCII
                       "!" / "#" /        ;  characters not including
                       "$" / "%" /        ;  specials.  Used for atoms.
                       "&" / "'" /
                       "*" / "+" /
                       "-" / "/" /
                       "=" / "?" /
                       "^" / "_" /
                       "`" / "{" /
                       "|" / "}" /
                       "~"

   atom            =   [CFWS] 1*atext [CFWS]

   dot-atom-text   =   1*atext *("." 1*atext)

To Reproduce

Steps to reproduce the behaviour:

  1. Create a file with a mailto: anchor with a + sign in the local part
  2. Scan it with htmltest
  3. See error

.htmltest.yml

DirectoryPath: public

Source files

https://justatheory.com/2013/06/sqitch-list/

Expected behaviour

A mailto: address with a + in the local part should be valid.

Actual behaviour

htmltest finds it invalid with this message:

  invalid email address (invalid format): 'sqitch-users [email protected]' --- 2013/06/sqitch-list/index.html --> mailto:[email protected]

Versions

  • OS: macOS 12.1

  • htmltest: [e.g. 0.10.1, run htmltest -v]

    $ htmltest -v
    htmltest 
    
    

Additional context

Thanks!

theory avatar Dec 30 '21 22:12 theory

Also added

IgnoreURLs:
  - mailto:[email protected]

To my config and htmltest still reports it. http URls on the list are properly ignored.

theory avatar Dec 31 '21 00:12 theory

This is a problem as I'm currently using github.com/badoux/checkmail to validate emails and their regex is failing the above. Likely need to remove this and replace with a much more forgiving one.

wjdp avatar Jan 28 '23 20:01 wjdp