Documentation
¶
Index ¶
- func StartEmailServer(opts StartEmailServerOptions)
- func StartWebserver(dist embed.FS, opts StartWebserverOptions)
- type Address
- type Attachment
- type Backend
- type Email
- type EmailCredentials
- type EmailRemainder
- type EmbeddedFile
- type ErrorResponse
- type Session
- type StartEmailServerOptions
- type StartWebserverOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartEmailServer ¶
func StartEmailServer(opts StartEmailServerOptions)
StartEmailServer starts the email server
func StartWebserver ¶
func StartWebserver(dist embed.FS, opts StartWebserverOptions)
StartWebserver starts the webserver
Types ¶
type Address ¶
Address with json attributes
func ConvertAddress ¶
ConvertAddress converts mail.Address to a Address
func ConvertAddressList ¶
ConvertAddressList converts a list of mail.Address to a list of Address
func MightConvertAddress ¶
MightConvertAddress converts *mail.Address to a *Address
type Attachment ¶
type Attachment struct {
Filename string `json:"filename"`
ContentType string `json:"contentType"`
Data []byte `json:"-"`
}
Attachment with json attributes
func ConvertAttachment ¶
func ConvertAttachment(at parsemail.Attachment) (Attachment, error)
ConvertAttachment converts parsemail.Attachment to a Attachment
func ConvertAttachmentList ¶
func ConvertAttachmentList(atList []parsemail.Attachment) ([]Attachment, error)
ConvertAttachmentList converts a list of parsemail.Attachment to a list of Attachment
type Backend ¶
type Backend struct {
Credentials *EmailCredentials
Entropy *rand.Rand
MaxEmails int
}
The Backend implements SMTP server methods.
type Email ¶
type Email struct {
// Added by our server
ID ulid.ULID `json:"id"`
RealDate time.Time `json:"realDate"`
Subject string `json:"subject"`
BodyType string `json:"bodyType"` // "html" or "text"
BodyHint string `json:"bodyHint"`
// Recived form the client
Sender *Address `json:"sender"`
From []*Address `json:"from"`
To []*Address `json:"to"`
Remainder EmailRemainder `json:"-"`
}
Email contains a single email
type EmailCredentials ¶
type EmailRemainder ¶
type EmailRemainder struct {
Raw string `json:"raw"`
Header mail.Header `json:"header"`
ReplyTo []*Address `json:"replyTo"`
Cc []*Address `json:"cc"`
Bcc []*Address `json:"bcc"`
Date time.Time `json:"date"`
MessageID string `json:"messageId"`
InReplyTo []string `json:"inReplyTo"`
References []string `json:"references"`
ResentFrom []*Address `json:"resentFrom"`
ResentSender *Address `json:"resentSender"`
ResentTo []*Address `json:"resentTo"`
ResentDate time.Time `json:"resentDate"`
ResentCc []*Address `json:"resentCc"`
ResentBcc []*Address `json:"resentBcc"`
ResentMessageID string `json:"resentMessageId"`
ContentType string `json:"contentType"`
HTMLBody string `json:"htmlBody"`
TextBody string `json:"textBody"`
Attachments []Attachment `json:"attachments"`
EmbeddedFiles []EmbeddedFile `json:"embeddedFiles"`
}
type EmbeddedFile ¶
type EmbeddedFile struct {
M *sync.Mutex `json:"-"`
CID string `json:"cid"`
ContentType string `json:"contentType"`
Data []byte `json:"-"`
}
EmbeddedFile with json attributes
func ConvertEmbeddedFile ¶
func ConvertEmbeddedFile(eb parsemail.EmbeddedFile) (EmbeddedFile, error)
ConvertEmbeddedFile converts parsemail.EmbeddedFile to a EmbeddedFile
func ConvertEmbeddedFileList ¶
func ConvertEmbeddedFileList(ebList []parsemail.EmbeddedFile) ([]EmbeddedFile, error)
ConvertEmbeddedFileList converts a list of parsemail.EmbeddedFile to a list of EmbeddedFile
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse is the response send by the server when an error occurs
type Session ¶
A Session is returned after EHLO.
func (*Session) Mail ¶
func (s *Session) Mail(from string, opts *smtp.MailOptions) error
Mail implements smtp.Session
type StartEmailServerOptions ¶
type StartEmailServerOptions struct {
Addr string
Domain string
Username string
Password string
MaxEmails uint16
Tls bool
}
StartEmailServerOptions are the options for starting the email server
type StartWebserverOptions ¶
StartWebserverOptions are the options for the webserver