knadh/smtppool: High throughput Go SMTP pool library with graceful handling of idle timeouts, errors, and retries.
github.com·4h
🐹Go Runtime
Preview
Report Post

smtppool

smtppool is a Go library that creates a pool of reusable SMTP connections for high throughput e-mailing. It gracefully handles idle connections, timeouts, and retries. The e-mail formatting, parsing, and preparation code is forked from jordan-wright/email.

Install

go get github.com/knadh/smtppool/v2

Usage

package main

import (
"log"
"time"

"github.com/knadh/smtppool/v2"
)

func main() {
// Try https://github.com/mailhog/MailHog for running a local dummy SMTP server.
// Create a new pool.
pool, err := smtppool.New(smtppool.Opt{
Host:            "localhost",
Port:            1025,
MaxConns:        10,
IdleTimeout:     time.Second * 10,
PoolWaitTimeout: time.Second * 3,
SSL:             smtppool.SSLNone
})
if err ...

Similar Posts

Loading similar posts...