Sample code for 30+ languages & platforms
Go

Transition from Email.CreateDsn to Email.ToDsn

Provides instructions for replacing deprecated CreateDsn method calls with ToDsn.

Chilkat Go Downloads

Go
    success := false

    email := chilkat.NewEmail()

    // ...
    // ...

    explanation := "..."
    statusFieldsXml := "..."
    headerOnly := false

    // ------------------------------------------------------------------------
    // The CreateDsn method is deprecated:

    emailObj := email.CreateDsn(explanation,statusFieldsXml,headerOnly)
    if email.LastMethodSuccess() == false {
        fmt.Println(email.LastErrorText())
        email.DisposeEmail()
        return
    }

    // ...
    // ...

    emailObj.DisposeEmail()

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

    dsnEmail := chilkat.NewEmail()
    success = email.ToDsn(explanation,statusFieldsXml,headerOnly,dsnEmail)
    if success == false {
        fmt.Println(email.LastErrorText())
        email.DisposeEmail()
        dsnEmail.DisposeEmail()
        return
    }


    email.DisposeEmail()
    dsnEmail.DisposeEmail()