Skip to content
  • Jim Brandt's avatar
    Improve logging for failed sender parsing in email · 1ba0f1a9
    Jim Brandt authored
    Starting with version 1.893, Email::Address returns undef
    if passed non-ASCII email addresses to parse.
    
    Track such email parsing failures in ParseSenderAddressFromHead and
    pass them back as an optional third parameter. This allows the
    caller to report the error if desired. Failure to parse one message
    will generate an error, but the function can still find and return
    a valid address from another header. This function is
    called from several places and returning the error rather than reporting
    avoids multiple warnings from parsing the same emails.
    
    ParseSenderAddressFromHead still reports a failure to find a sender
    in any header, since that is an error. That message will be reported
    multiple times, one for each call to the function.
    
    Update MailFrom.pm's GetCurrentUser to report the parse failures
    as a warning. These parse failures are reported even if a sender
    was found in another header. Also update the existing error in
    GetCurrentUser to indicate that a parsing failure can also
    prevent finding a valid sender.
    1ba0f1a9