Sample code for 30+ languages & platforms
Go Requires Chilkat v11.0.0+

Transition from Imap.FetchHeaders to Imap.FetchMsgSet

Provides instructions for replacing deprecated FetchHeaders method calls with FetchMsgSet.

Chilkat Go Downloads

Go
    success := false

    imap := chilkat.NewImap()

    //  ...
    //  ...

    mset := chilkat.NewMessageSet()
    success = imap.QueryMbx("FROM joe@example.com",true,mset)
    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The FetchHeaders method is deprecated:

    bundleObj := imap.FetchHeaders(mset)
    if imap.LastMethodSuccess() == false {
        fmt.Println(imap.LastErrorText())
        imap.DisposeImap()
        mset.DisposeMessageSet()
        return
    }

    //  ...
    //  ...

    bundleObj.DisposeEmailBundle()

    //  ------------------------------------------------------------------------
    //  Do the equivalent using FetchMsgSet.
    //  Your application creates a new, empty EmailBundle object which is passed 
    //  in the last argument and filled upon success.

    headersOnly := true

    bundleOut := chilkat.NewEmailBundle()
    success = imap.FetchMsgSet(headersOnly,mset,bundleOut)
    if success == false {
        fmt.Println(imap.LastErrorText())
        imap.DisposeImap()
        mset.DisposeMessageSet()
        bundleOut.DisposeEmailBundle()
        return
    }


    imap.DisposeImap()
    mset.DisposeMessageSet()
    bundleOut.DisposeEmailBundle()