sis

package
v5.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package "sis" provides types for data structure of sisimai

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeforeFact

type BeforeFact struct {
	Sender  string              // Unix FROM line ("From ")
	Headers map[string][]string // Email headers of the bounce mail
	Payload string              // Entire message body of the bounce mail
	RFC822  map[string][]string // Email headers of the original message
	Digest  []DeliveryMatter    // Decoded results returned from lhost/via-*.go
	Catch   interface{}         // Any data structure returned by the callback function [0]
	Errors  []NotDecoded        // All the errors and warnings
}

message.Rise() returns BeforeFact{}

func (*BeforeFact) HasDone

func (this *BeforeFact) HasDone() bool

*BeforeFact.HasDone returns false when Digest or RFC822 is empty.

func (*BeforeFact) IsEmpty

func (this *BeforeFact) IsEmpty() bool

*BeforeFact.IsEmpty returns true when Headers or body is empty.

type CallbackArg0

type CallbackArg0 struct {
	Headers map[string][]string // Email headers of the bounce mail
	Payload *string             // Entire message body of the bounce mail
}

CallbackArg0 is an argument of the first callback function that are called at message.sift(). It is aliased to sisimai.CallbackArg0 at the libsisimai.go

type CallbackArg1

type CallbackArg1 struct {
	Path string  // Path to the original email file or "<STDIN>" or "<MEMORY>"
	Kind string  // Kind of the original email file or "stdin" or "memory"
	Mail *string // Entire message body of the bounce mail including all the headers
	Fact *[]Fact // Decoded results
}

CallbackArg1 is an argument of the callback functions that are called at sisimai.Rise(). It is aliased to sisimai.CallbackArg1 at the libsisimai.go

type CfParameter0

type CfParameter0 func(arg *CallbackArg0) (map[string]interface{}, error)

CfParameter* is an argument of the callback function specified at sisimai.Rise()

type CfParameter1

type CfParameter1 func(arg *CallbackArg1) (bool, error)

type DecodingArgs

type DecodingArgs struct {
	Delivered bool         // Include sis.Fact{}.Action = "delivered" records in the decoded data
	Vacation  bool         // Include sis.Fact{}.Reason = "vacation" records in the decoded data
	Callback0 CfParameter0 // [0] The 1st callback function
	Callback1 CfParameter1 // [1] The 2nd callback function
}

DecodingArgs is an argument of the sisimai.Rise() function

type DeliveryMatter

type DeliveryMatter struct {
	Action       string // The value of Action header
	Agent        string // MTA name
	Alias        string // The value of alias entry(RHS)
	Command      string // SMTP command in the message body
	Date         string // The value of Last-Attempt-Date header
	Diagnosis    string // The value of Diagnostic-Code header
	FeedbackType string // Feedback type
	Lhost        string // The value of Received-From-MTA header
	Reason       string // Temporary reason of bounce
	Recipient    string // The value of Final-Recipient header
	ReplyCode    string // SMTP Reply Code
	Rhost        string // The value of Remote-MTA header
	Spec         string // Protocl specification
	Status       string // The value of Status header
}

func (*DeliveryMatter) AsRFC1894

func (this *DeliveryMatter) AsRFC1894(argv1 string) string

*DeliveryMatter.AsRFC1894 returns a lower-cased member name converted from a field name defined in RFC1894.

Arguments:
  - argv1 (string): Field name defined in RFC1894
Returns:
  - (string):       Member name of sis.DeliveryMatter struct

func (*DeliveryMatter) Select

func (this *DeliveryMatter) Select(argv0 string) string

*DeliveryMatter.Select returns the current value of the sis.DeliveryMatter instance.

Arguments:
  - argv0 (string): Lower-cased member name of sis.DeliveryMatter
Returns:
  - (string):       The value of the member name specified at argv0

func (*DeliveryMatter) Update

func (this *DeliveryMatter) Update(argv0 string, argv1 string) bool

*DeliveryMatter.Update set the argument into the member of sis.DeliveryMatter instance.

Arguments:
  - argv0 (string): Lower-cased member name of sis.DeliveryMatter
  - argv1 (string): New value to be updated
Returns:
  - (bool):         true if it has updated successfully

type EmailAddress

type EmailAddress struct {
	Address string // Email address
	User    string // Local part of the email addres
	Host    string // Domain part of the email address
	Verp    string // Expanded VERP address
	Alias   string // Expanded Alias of the email address
	Name    string // Display name
	Comment string // (Comment)
}

type Fact

type Fact struct {
	Action         string       `json:"action"`         // The value of "Action:" field
	Addresser      EmailAddress `json:"addresser"`      // The sender address of the original message
	Alias          string       `json:"alias"`          // The alias of the recipient address
	Catch          interface{}  `json:"catch"`          // Results generated by the user-defined callback function[1]
	Command        string       `json:"command"`        // The last SMTP command
	DecodedBy      string       `json:"decodedby"`      // MTA module name
	DeliveryStatus string       `json:"deliverystatus"` // "Status:" field value or the delivery status such as "5.2.2"
	Destination    string       `json:"destination"`    // The domain part of the "Recipient"
	DiagnosticCode string       `json:"diagnosticcode"` // "Diagnostic-Code:" field value or error messages in the message body
	DiagnosticType string       `json:"diagnostictype"` // The subtype of "Diagnostic-Code:" field such as "SMTP", "X-UNIX"
	FeedbackID     string       `json:"feedbackid"`     // The value of Feedback-ID: header of the original message
	FeedbackType   string       `json:"feedbacktype"`   // Feedback Type, always empty except when the Reason is "feedback"
	HardBounce     bool         `json:"hardbounce"`     // Hard bounce or not: true, false
	Lhost          string       `json:"lhost"`          // The hostname of the local mail server (the server attempting to send the email).
	ListID         string       `json:"listid"`         // The value of "List-Id" field of the original message
	MessageID      string       `json:"messageid"`      // The value of "Message-Id:" header of the original message
	Origin         string       `json:"origin"`         // The path of the bounce mail as a data source
	Reason         string       `json:"reason"`         // The Bounce reason name, which sisimai detected
	Rhost          string       `json:"rhost"`          // The hostname of the remote mail server (the server intended to receive the email).
	Recipient      EmailAddress `json:"recipient"`      // The recipient address of the original message
	ReplyCode      string       `json:"replycode"`      // SMTP Reply Code such as "421", which is picked from the error message
	SenderDomain   string       `json:"senderdomain"`   // The domain part of the "Addresser"
	Subject        string       `json:"subject"`        // The value of Subject: header of the original message
	Timestamp      time.Time    `json:"timestamp"`      // Unix machine time(int64) of that the email bounced
	TimezoneOffset string       `json:"timezoneoffset"` // Time zone offset of "Timestamp", such as "+0900"
	Token          string       `json:"token"`          // The Message token(MD5 Hex digest value)
}

func (Fact) Dump

func (this Fact) Dump() (string, error)

Fact.Dump() returns a serialized sis.Fact{} structure as a JSON string.

func (Fact) MarshalJSON

func (this Fact) MarshalJSON() ([]byte, error)

Fact.MarshalJSON returns serialized JSON string of "Addresser", "Recipient", and "Timestamp".

type NotDecoded

type NotDecoded struct {
	EmailFile string    // An email file name sisimai tried to decoded
	CalledOff bool      // Unrecoverable error, the decoding process have called off
	BecauseOf string    // An error message of the failure
	WhoCalled string    // Who called the constructor?
	DecodedBy string    // Copy of sis.Fact.DecodedBy
	Timestamp time.Time // When the error occurred
}

func MakeNotDecoded

func MakeNotDecoded(argv0 string, argv1 bool) *NotDecoded

MakeNotDecoded is a constructor of sis.NotDecoded struct.

Arguments:
  - argv0 (string): Error message
  - argv1 (bool):   Unrecoverable error or not
Returns:
  - (*NotDecoded):  Initialized error struct

func (*NotDecoded) Email

func (this *NotDecoded) Email(argv1 string) string

*NotDecoded.Email receives a path to email and set it into EmailFile.

Arguments:
  - argv1 (string): Path to an email being set into the EmailFile
Returns:
  - (string):       Current value of the EmailFile

func (*NotDecoded) Error

func (this *NotDecoded) Error() string

*NotDecoded.Error returns the error message as a string.

func (*NotDecoded) Label

func (this *NotDecoded) Label() string

*NotDecoded.Label returns a label string for printing error message.

type RisingUnderway

type RisingUnderway struct {
	Digest []DeliveryMatter // List of DeliveryMatter structs
	RFC822 string           // The original message
	Errors []NotDecoded     // Errors occurred in lhost/*
}

Each MTA function in lhost package returns sis.RisingUnderway

Jump to

Keyboard shortcuts

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