Postal error



  • The error in reading is the code:

    # coding: utf8
    import imaplib,email
    

    M = imaplib.IMAP4_SSL('imap.mail.ru')
    M.login(nick, pass)
    M.select()
    typ, data = M.search(None, '(FROM "from@mail.ru")')
    for num in data[0].split():
    typ, data = M.fetch(num, '(RFC3501)')
    raw = email.message_from_bytes(data[0][1])
    print (raw.get_payload(None,True))
    M.close()
    M.logout()

    There's a mistake:

    FETCH command error: BAD [b'[PARSE] Range parse error']



  • The error is not returned to the library, but to the server, because it can't detect the command parameter. fetch Protocol IMAP♪ Why are you transmitting? '(RFC3501)'What's the point? I don't know much. python And less with his libraries, but according to the description https://www.rfc-editor.org/rfc/rfc3501#page-54 The possible value of the parameter for receiving the body of the communication is the line 'RFC822'




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2