community: github.com/documize/community/domain/smtp Index | Files

package smtp

import "github.com/documize/community/domain/smtp"

Package smtp provides access to SMTP server for sending email.

Index

Package Files

send.go

func Connect Uses

func Connect(c Config) (d *mail.Dialer, err error)

Connect returns open connection to server for sending email

func SendMessage Uses

func SendMessage(d *mail.Dialer, c Config, em EmailMessage) (b bool, err error)

SendMessage sends email using specified SMTP connection

type Config Uses

type Config struct {
    // IP/hostname of SMTP server
    Host string

    // Port number of SMTP server
    Port int

    // Username for authentication with SMTP server
    Username string

    // Password for authentication with SMTP server
    Password string

    // SenderEmail is FROM address
    SenderEmail string

    // SenderName is FROM display name
    SenderName string

    // AnonymousAuth does not send username/password to server
    AnonymousAuth bool

    // Base64EncodeCredentials encodes User and Password as base64 before sending to SMTP server
    Base64EncodeCredentials bool

    // UseSSL uses SMTP SSL connection with SMTP server
    UseSSL bool

    // SkipSSLVerify allows unverified certificates
    SkipSSLVerify bool

    // SenderFQDN is the sending servers fully qualified domain name
    // as some SMTP servers require a value other than localhost.
    // e.g. docs.example.org
    SenderFQDN string
}

Config is used to create SMTP server connection

type EmailMessage Uses

type EmailMessage struct {
    ToEmail   string
    ToName    string
    Subject   string
    BodyHTML  string
    ReplyTo   string
    ReplyName string
}

EmailMessage represents email to be sent.

Package smtp imports 4 packages (graph) and is imported by 2 packages. Updated 2019-03-13. Refresh now. Tools for package owners.