smtp

package
v1.8.12 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package smtp provides SMTP server of the Bridge.

Index

Constants

View Source
const (
	FieldPMScheme   = "X-PM-SCHEME"
	FieldPMEncrypt  = "X-PM-ENCRYPT"
	FieldPMSign     = "X-PM-SIGN"
	FieldPMMIMEType = "X-PM-MIMETYPE"
)

Variables

This section is empty.

Functions

func NewSMTPBackend

func NewSMTPBackend(
	panicHandler panicHandler,
	eventListener listener.Listener,
	settings settingsProvider,
	bridge *bridge.Bridge,
) *smtpBackend

NewSMTPBackend returns struct implementing go-smtp/backend interface.

Types

type ContactMetadata

type ContactMetadata struct {
	Email     string
	Keys      []string
	Scheme    string
	Sign      bool
	SignIsSet bool
	Encrypt   bool
	MIMEType  string
}

func GetContactMetadataFromVCards

func GetContactMetadataFromVCards(cards []pmapi.Card, email string) (contactMeta *ContactMetadata, err error)

type SendPreferences

type SendPreferences struct {
	// Encrypt indicates whether the email should be encrypted or not.
	// If it's encrypted, we need to know which public key to use.
	Encrypt bool

	// Sign indicates whether the email should be signed or not.
	Sign bool

	// Scheme indicates if we should encrypt body and attachments separately and
	// what MIME format to give the final encrypted email. The two standard PGP
	// schemes are PGP/MIME and PGP/Inline. However we use a custom scheme for
	// internal emails (including the so-called encrypted-to-outside emails,
	// which even though meant for external users, they don't really get out of
	// our platform). If the email is sent unencrypted, no PGP scheme is needed.
	Scheme pmapi.PackageFlag

	// MIMEType is the MIME type to use for formatting the body of the email
	// (before encryption/after decryption). The standard possibilities are the
	// enriched HTML format, text/html, and plain text, text/plain. But it's
	// also possible to have a multipart/mixed format, which is typically used
	// for PGP/MIME encrypted emails, where attachments go into the body too.
	// Because of this, this option is sometimes called MIME format.
	MIMEType string

	// PublicKey contains an OpenPGP key that can be used for encryption.
	PublicKey *crypto.KeyRing
}

SendPreferences contains information about how to handle a message. It is derived from contact data, api key data, mail settings and composer preferences.

type Server added in v1.8.0

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

Server is Bridge SMTP server implementation.

func NewSMTPServer

func NewSMTPServer(
	panicHandler panicHandler,
	debug bool, port int, useSSL bool,
	tls *tls.Config,
	smtpBackend goSMTP.Backend,
	eventListener listener.Listener,
) *Server

NewSMTPServer returns an SMTP server configured with the given options.

func (*Server) Address added in v1.8.7

func (s *Server) Address() string

func (*Server) Close added in v1.8.0

func (s *Server) Close()

Close turns off server and monitors.

func (*Server) DebugClient added in v1.8.7

func (s *Server) DebugClient() bool

func (*Server) DebugServer added in v1.8.7

func (s *Server) DebugServer() bool

func (*Server) DisconnectUser added in v1.8.0

func (s *Server) DisconnectUser(address string)

func (*Server) HandlePanic added in v1.8.0

func (s *Server) HandlePanic()

func (*Server) ListenAndServe added in v1.8.0

func (s *Server) ListenAndServe()

ListenAndServe will run server and all monitors.

func (Server) Protocol added in v1.8.7

func (Server) Protocol() serverutil.Protocol

func (*Server) Serve added in v1.8.7

func (s *Server) Serve(l net.Listener) error

func (*Server) SetLoggers added in v1.8.7

func (s *Server) SetLoggers(localDebug, remoteDebug io.Writer)

func (*Server) StopServe added in v1.8.7

func (s *Server) StopServe() error

func (*Server) TLSConfig added in v1.8.7

func (s *Server) TLSConfig() *tls.Config

func (*Server) UseSSL added in v1.8.7

func (s *Server) UseSSL() bool

Jump to

Keyboard shortcuts

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