Documentation
¶
Index ¶
- func LogError(context string, err error)
- func LogInfo(context string, msg string)
- func LogWarning(context string, msg string)
- func MultipartIterator(r io.Reader, boundary string) iter.Seq2[*multipart.Part, error]
- type Backend
- type Email
- type EmailContent
- type EmailContentHeader
- type EmailUser
- type HeaderContentType
- type Headers
- type MimeHeaders
- type SPFRecord
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogWarning ¶
Types ¶
type Backend ¶
type Backend struct { TrustedDomains []string OnEmailReceived func(email *Email) OnEmailFailed func(from EmailUser, to []EmailUser, raw io.Reader, err error) }
Backend implements the SMTP backend.
func NewBackend ¶
func (*Backend) NewSession ¶
NewSession initializes a new SMTP session.
type Email ¶
type Email struct { // Unique ID for the email ID string `json:"ID,omitempty"` // Timestamp when the email was received ReceivedAt time.Time `json:"ReceivedAt,omitempty"` // Client ip address ClientIP net.IP // From is the email address of the sender. From EmailUser // Recipients is a list of email addresses of the recipients like To, Cc and Bcc. RcptTo []EmailUser // To is a list of email addresses of the recipients like To, Cc Recipients []EmailUser // Subject is the subject of the email. Subject string // Headers is a map of additional headers to include in the email. Headers *MimeHeaders // Raw is the raw email data. filename: email.eml Raw io.Reader // Body is the body of the email. Body io.Reader // Raw body data, can be plain text or HTML. BodyText *EmailContent BodyHTML *EmailContent // Attachments is a list of file paths to attach to the email. Attachments []*EmailContent // Verification checks SPF bool // SPF check result DKIM bool // DKIM check result DMARC bool // DMARC check result }
type EmailContent ¶
type EmailContent struct { R io.Reader `json:"R,omitempty"` // R is the reader for the part's content. Headers EmailContentHeader `json:"Headers,omitempty"` // Headers are the headers associated with the part. Size int64 `json:"Size,omitempty"` // Size is the size of the content in bytes. }
EmailContent represents a part of an email, such as the body or an attachment. it is also an io.Reader to read the content.
func (*EmailContent) ContentType ¶
func (rp *EmailContent) ContentType() string
func (*EmailContent) Filename ¶
func (rp *EmailContent) Filename() string
type EmailContentHeader ¶
type EmailContentHeader struct { MimeVersion string `json:"MIME-Version,omitempty"` // MIME-Version ContentType HeaderContentType `json:"Content-Type,omitempty"` // Content-Type ContentTransferEncoding string `json:"Content-Transfer-Encoding,omitempty"` // Content-Transfer-Encoding Extra Headers `json:"Extra,omitempty"` // Extra headers }
type EmailUser ¶
type HeaderContentType ¶
type HeaderContentType struct { MediaType string `json:"Media-Type,omitempty"` // MediaType is the main type of the content, e.g., "text" SubType string `json:"Sub-Type,omitempty"` // SubType is the subtype of the content, e.g., "plain" Params Headers `json:"Params,omitempty"` // Params are additional parameters, e.g., charset, boundary }
type MimeHeaders ¶
type MimeHeaders struct { MimeVersion string `json:"MIME-Version,omitempty"` // MIME-Version Date string `json:"Date,omitempty"` // Date Subject string `json:"Subject,omitempty"` // Subject From EmailUser `json:"From,omitempty"` // From To []EmailUser `json:"To,omitempty"` // To Cc []EmailUser `json:"Cc,omitempty"` // Cc ContentType HeaderContentType `json:"Content-Type,omitempty"` // Content-Type ContentTransferEncoding string `json:"Content-Transfer-Encoding,omitempty"` // Content-Transfer-Encoding Extra Headers `json:"Extra,omitempty"` // Extra headers }
type SPFRecord ¶
type SPFRecord struct { Domain string // contains filtered or unexported fields }
IpRange holds IPv4 and IPv6 CIDR ranges.
func NewSPFRecord ¶
type Session ¶
type Session struct { State *smtp.Conn TrustedDomains []string From EmailUser RcptTo []EmailUser Email *Email // Current email being processed OnEmailReceived func(email *Email) OnEmailFailed func(from EmailUser, to []EmailUser, raw io.Reader, err error) }
A Session is returned after successful login.
Click to show internal directories.
Click to hide internal directories.