v2: why not give some demo?
yangyile1990 opened this issue · 1 comments
package main
import (
"fmt"
"github.com/emersion/go-imap/v2"
"github.com/emersion/go-imap/v2/imapclient"
"gitlab.yyle.com/golang/uvyyle.git/utils_check"
softjson "gitlab.yyle.com/golang/uvyyle.git/utils_encoding/utils_encoding_json/utils_encoding_json_soft"
)
/*
以下是一个使用 github.com/emersion/go-imap/v2
库批量删除收件箱中邮件的示例代码:
*/
func main() {
imapServer := "imap.163.com"
imapPort := "993"
username := "---"
password := "---"
// 连接到 IMAP 服务器
c, err := imapclient.DialTLS(imapServer+":"+imapPort, nil)
utils_check.Done(err)
defer c.Logout()
// 进行身份验证
err = c.Login(username, password).Wait()
utils_check.Done(err)
// 选择收件箱
mbox, err := c.Select("INBOX", &imap.SelectOptions{}).Wait()
utils_check.Done(err)
fmt.Println(softjson.NeatString(mbox))
}
/*
在此示例中,我们使用 go-imap/v2
库连接到 IMAP 服务器,并进行身份验证。
然后,我们选择收件箱,并搜索收件箱中的所有邮件的 UID。
接下来,我们构建一个删除命令,并使用 UidStore
函数将其应用于找到的邮件 UID。
最后,我们输出成功删除的邮件数量。
请注意,此代码仅为示例目的。
在实际应用中,您可能需要添加错误处理、日志记录和其他逻辑来满足您的需求。
此外,请确保将 imap.example.com
替换为您的 IMAP 服务器地址,your_username
和 your_password
替换为您的凭据信息。
在编写与 IMAP 服务器交互的代码时,请确保遵循 IMAP 协议的规范和最佳实践,并根据您的需求进行适当的调整和扩展。
*/
2023-10-25T10:42:57.097+0700 PANIC main_delete_emails/main.go:31:main.main NO ERROR BUG {"error": "imap: NO SELECT Unsafe Login. Please contact kefu@188.com for help"}
please give me some demo.
my inbox is full i want select all inbox and the delete it.
thank you.
The issue tracker is only for bug reports, as the issue template indicates.