Sample code for 30+ languages & platforms
Go

Transition from Imap.FetchSingleHeader to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingleHeader method calls with FetchEmail.

Chilkat Go Downloads

Go
    success := false

    imap := chilkat.NewImap()

    // ...
    // ...

    // ------------------------------------------------------------------------
    // The FetchSingleHeader method is deprecated:

    emailObj := imap.FetchSingleHeader(1,false)
    if imap.LastMethodSuccess() == false {
        fmt.Println(imap.LastErrorText())
        imap.DisposeImap()
        return
    }

    // ...
    // ...

    emailObj.DisposeEmail()

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

    headerOnly := true

    emailOut := chilkat.NewEmail()
    success = imap.FetchEmail(headerOnly,1,false,emailOut)
    if success == false {
        fmt.Println(imap.LastErrorText())
        imap.DisposeImap()
        emailOut.DisposeEmail()
        return
    }


    imap.DisposeImap()
    emailOut.DisposeEmail()