shoutrrr: github.com/containrrr/shoutrrr/pkg/services/smtp Index | Files

package smtp

import "github.com/containrrr/shoutrrr/pkg/services/smtp"

Index

Package Files

smtp.go smtp_authtype.go smtp_config.go smtp_failures.go smtp_oauth2.go

Constants

const (
    // FailUnknown is the default FailureID
    FailUnknown failures.FailureID = iota
    // FailGetSMTPClient is returned when a SMTP client could not be created
    FailGetSMTPClient
    // FailEnableStartTLS is returned when failing to enable StartTLS
    FailEnableStartTLS
    // FailAuthType is returned when the Auth type could not be identified
    FailAuthType
    // FailAuthenticating is returned when the authentication fails
    FailAuthenticating
    // FailSendRecipient is returned when sending to a recipient fails
    FailSendRecipient
    // FailClosingSession is returned when the server doesn't accept the QUIT command
    FailClosingSession
    // FailPlainHeader is returned when the text/plain multipart header could not be set
    FailPlainHeader
    // FailHTMLHeader is returned when the text/html multipart header could not be set
    FailHTMLHeader
    // FailMultiEndHeader is returned when the multipart end header could not be set
    FailMultiEndHeader
    // FailMessageTemplate is returned when the message template could not be written to the stream
    FailMessageTemplate
    // FailMessageRaw is returned when a non-templated message could not be written to the stream
    FailMessageRaw
    // FailSetSender is returned when the server didn't accept the sender address
    FailSetSender
    // FailSetRecipient is returned when the server didn't accept the recipient address
    FailSetRecipient
    // FailOpenDataStream is returned when the server didn't accept the data stream
    FailOpenDataStream
    // FailWriteHeaders is returned when the headers could not be written to the data stream
    FailWriteHeaders
    // FailCloseDataStream is returned when the server didn't accept the data stream contents
    FailCloseDataStream
    // FailConnectToServer is returned when the TCP connection to the server failed
    FailConnectToServer
    // FailCreateSMTPClient us returned when the smtp.Client initialization failed
    FailCreateSMTPClient
)
const Scheme = "smtp"

Scheme is the identifying part of this service's configuration URL

Variables

var OAuth2 = authTypes.OAuth2

func OAuth2Auth Uses

func OAuth2Auth(username, accessToken string) smtp.Auth

OAuth2Auth returns an Auth that implements the SASL XOAUTH2 authentication as per https://developers.google.com/gmail/imap/xoauth2-protocol

type Config Uses

type Config struct {
    Host        string   `desc:"SMTP server hostname or IP address"`
    Username    string   `desc:"authentication username"`
    Password    string   `desc:"authentication password or hash"`
    Port        uint16   `desc:"SMTP server port, common ones are 25, 465, 587 or 2525" default:"25"`
    FromAddress string   `desc:"e-mail address that the mail are sent from"`
    FromName    string   `desc:"name of the sender" optional:"yes"`
    ToAddresses []string `desc:"list of recipient e-mails separated by \",\" (comma)"`
    Subject     string   `desc:"the subject of the sent mail" param:"subject" default:"Shoutrrr Notification"`
    Auth        authType `desc:"SMTP authentication method"`
    UseStartTLS bool     `desc:"attempt to use SMTP StartTLS encryption" default:"Yes"`
    UseHTML     bool     `desc:"whether the message being sent is in HTML" default:"No"`
}

Config is the configuration needed to send e-mail notifications over SMTP

func (Config) Enums Uses

func (config Config) Enums() map[string]types.EnumFormatter

Enums returns the fields that should use a corresponding EnumFormatter to Print/Parse their values

func (*Config) Get Uses

func (config *Config) Get(key string) (string, error)

Get returns the value of a Query field

func (*Config) GetURL Uses

func (config *Config) GetURL() *url.URL

GetURL returns a URL representation of it's current field values

func (*Config) QueryFields Uses

func (config *Config) QueryFields() []string

QueryFields returns the fields that are part of the Query of the service URL

func (*Config) Set Uses

func (config *Config) Set(key string, value string) error

Set updates the value of a Query field

func (*Config) SetURL Uses

func (config *Config) SetURL(url *url.URL) error

SetURL updates a ServiceConfig from a URL representation of it's field values

type Service Uses

type Service struct {
    standard.Standard
    standard.Templater
    // contains filtered or unexported fields
}

Service sends notifications to a given e-mail addresses via SMTP

func (*Service) Initialize Uses

func (service *Service) Initialize(configURL *url.URL, logger *log.Logger) error

Initialize loads ServiceConfig from configURL and sets logger for this Service

func (*Service) Send Uses

func (service *Service) Send(message string, params *types.Params) error

Send a notification message to e-mail recipients

Package smtp imports 15 packages (graph) and is imported by 1 packages. Updated 2020-11-19. Refresh now. Tools for package owners.