smtp

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: GPL-3.0 Imports: 27 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,
	preferences *config.Preferences,
	bridge *bridge.Bridge,
) *smtpBackend

NewSMTPBackend returns struct implementing go-smtp/backend interface.

func NewSMTPServer

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

NewSMTPServer returns an SMTP server configured with the given options.

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.

Jump to

Keyboard shortcuts

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