dsn

package module
v0.0.0-...-d8c31d7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 12 Imported by: 0

README

go-dsn

This is a fork of foxcpp/maddy internal/dsn package at commit b8452b35756060d02ef86f030c41c9f0a1f1526e before it changed to GPLv3.

A copy of the MIT License is included in this package.

It implements RFC 3464 and RFC 3462, this package will stay standalone.

Documentation

Overview

Package dsn contains the utilities used for dsn message (DSN) generation.

It implements RFC 3464 and RFC 3462.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnicodeMailbox = errors.New("address: cannot convert the Unicode local-part to the ACE form")
)
View Source
var FailedTemplateText = `` /* 414-byte string literal not displayed */

FailedTemplateText is the text of the human-readable part of DSN.

Functions

func GenerateDSN

func GenerateDSN(utf8 bool, envelope Envelope, mtaInfo ReportingMTAInfo, rcptsInfo []RecipientInfo, failedHeader textproto.Header, outWriter io.Writer) (textproto.Header, error)

GenerateDSN is a top-level function that should be used for generation of the DSNs.

DSN header will be returned, body itself will be written to outWriter.

func SendDSN

func SendDSN(smtpaddr string, utf8 bool, envelope Envelope, mtaInfo ReportingMTAInfo, rcptsInfo []RecipientInfo, failedHeader textproto.Header) error

SendDSN generates and sends DSN via an smtp relay From Addr defaults to <>

Types

type Action

type Action string
const (
	ActionFailed    Action = "failed"
	ActionDelayed   Action = "delayed"
	ActionDelivered Action = "delivered"
	ActionRelayed   Action = "relayed"
	ActionExpanded  Action = "expanded"
)

type Envelope

type Envelope struct {
	MsgID string
	From  string
	To    string
}

type RecipientInfo

type RecipientInfo struct {
	FinalRecipient string
	RemoteMTA      string

	Action Action
	Status smtp.EnhancedCode

	// DiagnosticCode is the error that will be returned to the sender.
	DiagnosticCode error
	// contains filtered or unexported fields
}

func (RecipientInfo) WriteTo

func (info RecipientInfo) WriteTo(utf8 bool, w io.Writer) error

type ReportingMTAInfo

type ReportingMTAInfo struct {
	ReportingMTA    string
	ReceivedFromMTA string

	// XMTAName if empty it defaults to Godsn, and is used as MTA name in
	// the X-HeaderKey (e.g. X-Godsn-Sender) - rfc3464 section 2.4
	XMTAName string

	// Message sender address, included as 'X-Godsn-Sender: rfc822; ADDR' field.
	XSender string

	// Message identifier, included as 'X-Godsn-MsgId: MSGID' field.
	XMessageID string

	// Time when message was enqueued for delivery by Reporting MTA.
	ArrivalDate time.Time

	// Time when message delivery was attempted last time.
	LastAttemptDate time.Time
}

func (ReportingMTAInfo) WriteTo

func (info ReportingMTAInfo) WriteTo(utf8 bool, w io.Writer) error

Jump to

Keyboard shortcuts

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