Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to parse msg.body #43

Closed
webluoye opened this issue Aug 11, 2016 · 1 comment
Closed

how to parse msg.body #43

webluoye opened this issue Aug 11, 2016 · 1 comment

Comments

@webluoye
Copy link

webluoye commented Aug 11, 2016

err = c.Fetch(seqset, []string{"ENVELOPE", "RFC822.HEADER", "RFC822.TEXT"}, messages)
    if err != nil {
        log.Fatal(err)
    }

for msg := range messages {
        log.Println(msg.Envelope.Subject)
        //log.Println(msg.Body) 
    }

msg.body return text how to parse email body get struct

thk

@emersion
Copy link
Owner

emersion commented Aug 11, 2016

You can parse msg.Body using the net/mail package: see the example at https://golang.org/pkg/net/mail/#ReadMessage

However, you must add BODY[] to the list of fetched items, otherwise msg.Body will be empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants