Sample code for 30+ languages & platforms
Go

Transition from Imap.FetchSingle to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail.

Chilkat Go Downloads

Go
    success := false

    imap := chilkat.NewImap()

    // ...
    // ...

    // ------------------------------------------------------------------------
    // The FetchSingle method is deprecated:

    emailObj := imap.FetchSingle(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 := false

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


    imap.DisposeImap()
    email.DisposeEmail()