All frameworks

Send Email from Echo

Send emails from Echo HTTP handlers

1

Install the SDK

go get github.com/sendpigeon/sendpigeon-go
2

Set your API key

SENDPIGEON_API_KEY=your_api_key_here

Get your API key from the dashboard.

3

Send your first email

go
package main

import (
	"net/http"
	"os"

	"github.com/labstack/echo/v4"
	"github.com/sendpigeon/sendpigeon-go/sendpigeon"
)

func main() {
	client := sendpigeon.New(os.Getenv("SENDPIGEON_API_KEY"))
	e := echo.New()

	e.POST("/contact", func(c echo.Context) error {
		var req struct {
			Email string `json:"email"`
			Name  string `json:"name"`
		}
		c.Bind(&req)

		client.Send(c.Request().Context(), sendpigeon.SendEmailRequest{
			To:      []string{req.Email},
			From:    "hello@yourdomain.com",
			Subject: "Thanks for reaching out, " + req.Name + "!",
			HTML:    "<h1>We got your message</h1><p>We'll get back to you soon.</p>",
		})

		return c.JSON(http.StatusOK, map[string]bool{"success": true})
	})

	e.Start(":3000")
}

Why use SendPigeon with Echo?

  • Minimalist design
  • Context propagation
  • Extensible middleware
  • 99.9% deliverability with dedicated IPs
  • Real-time analytics and webhook events
🧪

Testing locally? Use our local email server to catch emails without sending real ones.

🎨

Prefer visual editing? Build email templates with our free drag-and-drop builder. Learn more →

Ready to send emails from Echo?

Start free with 3,000 emails/month. No credit card required.

Get Started Free

Other go frameworks