Javamail problem with ñ characters in mail addresses

后端 未结 6 688
花落未央
花落未央 2021-01-19 01:16

I\'m having problems with parse method when usising ñ character:

essage.setRecipients(Message.RecipientType.TO, internetAddress.parse(\"somedir.         


        
6条回答
  •  一个人的身影
    2021-01-19 01:27

    JavaMail's address parser is telling you something very important here: You may only use normal printable ASCII characters on the left side of the @ sign in an email address. Check out RFC 5322 for the ABNF for valid email addresses:

    addr-spec       =   local-part "@" domain
    
    local-part      =   dot-atom / quoted-string / obs-local-part
    
    dot-atom        =   [CFWS] dot-atom-text [CFWS]
    
    dot-atom-text   =   1*atext *("." 1*atext)
    
    atext           =   ALPHA / DIGIT /    ; Printable US-ASCII
                        "!" / "#" /        ;  characters not including
                        "$" / "%" /        ;  specials.  Used for atoms.
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"
    
    quoted-string   =   [CFWS]
                        DQUOTE *([FWS] qcontent) [FWS] DQUOTE
                        [CFWS]
    
    qcontent        =   qtext / quoted-pair
    
    quoted-pair     =   ("\" (VCHAR / WSP)) / obs-qp
    
    qtext           =   %d33 /             ; Printable US-ASCII
                        %d35-91 /          ;  characters not including
                        %d93-126 /         ;  "\" or the quote character
                        obs-qtext
    

    Make sure that the address is correct before you go any further.

提交回复
热议问题