NewClient (smtp/smtp.go)

chasquid · internal/smtp/smtp.go · go · Apache-2.0
email

SMTP client with SMTPUTF8 support for Go applications.

// Source: https://github.com/albertito/chasquid | License: Apache-2.0 | Copyright 2016
// Provided via justclaw.it.com; keep this notice with the code.
// Package smtp implements the Simple Mail Transfer Protocol as defined in RFC
// 5321.  It extends net/smtp as follows:
//
//   - Supports SMTPUTF8, via MailAndRcpt.
//   - Adds IsPermanent.
package smtp

import (
	"bufio"
	"io"
	"net"
	"net/smtp"
	"net/textproto"
	"unicode"

	"blitiri.com.ar/go/chasquid/internal/envelope"

	"golang.org/x/net/idna"
)

// A Client represents a client connection to an SMTP server.
type Client struct {
	*smtp.Client
}

// NewClient uses the given connection to create a new Client.
func NewClient(conn net.Conn, host string) (*Client, error) {
	c, err := smtp.NewClient(conn, host)
	if err != nil {
		return nil

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key