Sample code for 30+ languages & platforms
Go

Transition from Imap.FetchBundleAsMime to Imap.FetchSingleBd

Provides instructions for replacing deprecated FetchBundleAsMime method calls with FetchSingleBd.

Chilkat Go Downloads

Go
    success := false

    imap := chilkat.NewImap()

    // ...
    // ...

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

    // ------------------------------------------------------------------------
    // The FetchBundleAsMime method is deprecated:

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

    // ...
    // ...

    saObj.DisposeStringArray()

    // ------------------------------------------------------------------------
    // Do the equivalent using FetchSingleBd.

    imap.SetAutoDownloadAttachments(true)

    bdMime := chilkat.NewBinData()
    bUid := mset.HasUids()
    numEmails := mset.Count()
    i := 0
    for i < numEmails {
        success = imap.FetchSingleBd(*mset.GetId(i),bUid,bdMime)
        // ...
        // ...

        i = i + 1
    }


    imap.DisposeImap()
    mset.DisposeMessageSet()
    bdMime.DisposeBinData()