Select mailbox “sent mail” or “all mail” in Ruby Net::IMAP

后端 未结 4 1233
温柔的废话
温柔的废话 2020-12-28 17:47

I\'m trying to use Net::IMAP in Ruby to search all mail sent by me, but I\'m having trouble selecting anything other than INBOX.

imap.select(\'INBOX\')
         


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-28 17:55

    The "sent mail" folder will differ from provider to provider. Gmail's "sent mail" folder is named "[Gmail]/Sent Mail". Select that instead and it'll work.

    imap.select('[Gmail]/Sent Mail')
    

    FYI, Gmail's system folders are the following:

    • INBOX
    • [Gmail]/All Mail
    • [Gmail]/Drafts
    • [Gmail]/Sent Mail
    • [Gmail]/Spam
    • [Gmail]/Starred
    • [Gmail]/Trash

提交回复
热议问题