> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendpost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Golang SDK Quickstart

> Learn how to configure and send your first email with SendPost Golang SDK

## Prerequisites

To get the most out of this guide, you'll need to:

* [**Create a SendPost Account**](https://app.sendpost.io/register)
* [**Install GoLang >v1.19.0**](https://go.dev/doc/install)
* A **Sub-Account API Key** from your SendPost dashboard

<Info>
  You can find your API keys in your [SendPost
  Dashboard](https://app.sendpost.io). Make sure to use your Sub-Account API Key
  for sending emails.
</Info>

## 1. Install

```shellscript Shell theme={null}
go get github.com/sendpost/sendpost_go_sdk
```

## 2. Getting Started

```go Go theme={null}
package main

import (
	"fmt"
	"os"
	
	sendpost "github.com/sendpost/sendpost_go_sdk"
)

func main() {
	cfg := sendpost.NewConfiguration()
	client := sendpost.NewAPIClient(cfg)

	emailMessage := sendpost.EmailMessage{}
	emailMessage.SetSubject("Hello World")
	emailMessage.SetHtmlBody("<strong>it works!</strong>")
	emailMessage.From = &sendpost.From{}
	emailMessage.From.SetEmail("richard@piedpiper.com")
	
	tos := make([]sendpost.To, 0)
	to := &sendpost.To{}
	to.SetEmail("gavin@hooli.com")
	tos = append(tos, *to)
	emailMessage.To = tos

	emailRequest := sendpost.ApiSendEmailRequest{}
	emailRequest = emailRequest.XSubAccountApiKey("your_api_key")
	emailRequest = emailRequest.EmailMessage(emailMessage)
	
	res, _, err := client.EmailApi.SendEmailExecute(emailRequest)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling EmailApi->SendEmail: %v\n", err)
		return
	}
	fmt.Fprintf(os.Stdout, "Response: %v\n", res)
}
```

<Warning>
  Make sure your sender email domain is verified in your SendPost account before
  sending emails.
</Warning>

## 3. Next Steps

Explore more examples and use cases:

<Columns cols={3}>
  <Card title="Golang SDK" icon="golang" href="https://github.com/sendpost/sendpost_go_sdk">
    View the official SDK on GitHub
  </Card>

  <Card title="SDK Examples" icon="github" href="https://github.com/sendpost/sendpost-examples-go">
    Comprehensive email sending examples
  </Card>

  <Card title="ESP Workflow Example" icon="diagram-project" href="https://github.com/sendpost/go-esp-example">
    Full-featured example app with comprehensive ESP workflow
  </Card>
</Columns>
