trysmtp

package module
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2023 License: LGPL-3.0 Imports: 5 Imported by: 2

README

trySMTP

Library that tries to connect to SMTP host by TO/target email address:

  • Lookup MX and A
  • Try to connect to SMTP on different ports
  • Try to use STARTTLS if server supports it
  • Return SMTP Client with Mail() and Rcpt() already called
from := "sender@example.com"
to := "target@example.org"
client, err := trysmtp.Connect(from, to)
if err != nil {
	// something went wrong!
}

client.Data([]byte("your email data here"))

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SMTPAddrs = []string{":25", ":587", ":465"}

SMTPAddrs priority list

Functions

func Connect

func Connect(from, to string) (*smtp.Client, error)

Connect to SMTP server and call MAIL and RCPT commands NOTE: check if client is not nil, because it can return non-fatal errors with initialized client

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL