Maximum internet email Message-ID length

前端 未结 2 1150
无人共我
无人共我 2021-01-01 17:33

I\'m looking for the maximum character length allowed for an internet Message-ID field for validation purposes within an application. I\'ve reviewed sources such as RFC-282

2条回答
  •  旧巷少年郎
    2021-01-01 17:39

    Actually there's no limit

    RFC2822 defines these productions:

    message-id      =       "Message-ID:" msg-id CRLF
    
    msg-id          =       [CFWS] "<" id-left "@" id-right ">" [CFWS]
    
    id-left         =       dot-atom-text / no-fold-quote / obs-id-left
    
    obs-id-left     =       local-part
    
    local-part      =       dot-atom / quoted-string / obs-local-part
    
    quoted-string   =       [CFWS]
                            DQUOTE *([FWS] qcontent) [FWS] DQUOTE
                            [CFWS]
    
    CFWS            =       *([FWS] comment) (([FWS] comment) / FWS)
    
    FWS             =       ([*WSP CRLF] 1*WSP) /   ; Folding white space
    

    So id-left can be local-part which can be quoted-string (and thus have multiple FWS) so you can fold it as many times as needed to fit any arbitrary length of payload and still comply with the restrictions given by the RFC.

提交回复
热议问题