watchtower: github.com/containrrr/watchtower/pkg/notifications Index | Files

package notifications

import "github.com/containrrr/watchtower/pkg/notifications"

Package notifications ... Copyright 2010 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license.

Index

Package Files

email.go gotify.go msteams.go notifier.go slack.go smtp.go util.go

func SendMail Uses

func SendMail(addr string, insecureSkipVerify bool, a smtp.Auth, from string, to []string, msg []byte) error

SendMail connects to the server at addr, switches to TLS if possible, authenticates with the optional mechanism a if possible, and then sends an email from address from, to addresses to, with message msg. The addr must include a port, as in "mail.example.com:smtp".

The addresses in the to parameter are the SMTP RCPT addresses.

The msg parameter should be an RFC 822-style email with headers first, a blank line, and then the message body. The lines of msg should be CRLF terminated. The msg headers should usually include fields such as "From", "To", "Subject", and "Cc". Sending "Bcc" messages is accomplished by including an email address in the to parameter but not including it in the msg headers.

The SendMail function and the net/smtp package are low-level mechanisms and provide no support for DKIM signing, MIME attachments (see the mime/multipart package), or other mail functionality. Higher-level packages exist outside of the standard library.

func SplitSubN Uses

func SplitSubN(s string, n int) []string

SplitSubN splits a string into a list of string with each having a maximum number of characters n

type Notifier Uses

type Notifier struct {
    // contains filtered or unexported fields
}

Notifier can send log output as notification to admins, with optional batching.

func NewNotifier Uses

func NewNotifier(c *cobra.Command) *Notifier

NewNotifier creates and returns a new Notifier, using global configuration.

func (*Notifier) SendNotification Uses

func (n *Notifier) SendNotification()

SendNotification sends any notifications accumulated since StartNotification() was called.

func (*Notifier) StartNotification Uses

func (n *Notifier) StartNotification()

StartNotification starts a log batch. Notifications will be accumulated after this point and only sent when SendNotification() is called.

Package notifications imports 17 packages (graph) and is imported by 3 packages. Updated 2019-08-27. Refresh now. Tools for package owners.