fetch sent emails from gmail imap using nodejs

荒凉一梦 提交于 2020-06-29 03:51:15

问题


I'm trying to fetch SENT emails from gmail server using nodemailer through Imap.

the solution below is not working and the result is the INBOX not SENT

var imap = new Imap({
        user: request.body.email,
        password: request.body.password,
        host: '{imap.gmail.com:993/imap/ssl}INBOX.Sent',
        port: 993,
        tlsOptions: { rejectUnauthorized: false },
        tls: true
    });

回答1:


Take a look on the next links:

  1. Special-Use Extension of the LIST command
...
* LIST (\HasNoChildren \Sent) "/" "[Gmail]/Sent Mail"
...

As you can see [Gmail]/Sent Mail is all what you need.

Remember, the label name will be changed if your interface language is different to english.

  1. And here is an example about how to Access to Gmail labels: X-GM-LABELS
...
* 1 FETCH (X-GM-LABELS (\Inbox \Sent Important "Muy Importante"))
...


来源:https://stackoverflow.com/questions/61581925/fetch-sent-emails-from-gmail-imap-using-nodejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!