Documentation
¶
Index ¶
- Constants
- type AttachmentPart
- type Content
- func (c *Content) AsAttachment() (*AttachmentPart, error)
- func (c *Content) AsForm() (*FormPart, error)
- func (c *Content) AsInline() (*InlinePart, error)
- func (c *Content) Decode() ([]byte, error)
- func (c *Content) Encoding() string
- func (c *Content) Flatten() []*Content
- func (c *Content) IsAttachment() bool
- func (c *Content) IsForm() bool
- func (c *Content) IsInline() bool
- func (c *Content) Leaf() bool
- func (c *Content) Walk(fn func(*Content, int) error) error
- type Data
- func (d *Data) Bytes() []byte
- func (d *Data) Len() int
- func (d *Data) Prepend(p []byte) (n int, err error)
- func (d *Data) PrependString(s string) (n int, err error)
- func (d *Data) ReadFrom(r io.Reader) (n int64, err error)
- func (d *Data) Reader() io.Reader
- func (d *Data) String() string
- func (d *Data) Write(p []byte) (n int, err error)
- func (d *Data) WriteString(s string) (n int, err error)
- type DecodingOption
- type Envelope
- func (e *Envelope) ConnectionId() uint64
- func (e *Envelope) Context() context.Context
- func (e *Envelope) EnvelopeId() string
- func (e *Envelope) GetError() error
- func (e *Envelope) Mail() (*Mail, error)
- func (e *Envelope) PrependHeader(key, value string) error
- func (e *Envelope) SetError(err error)
- func (e *Envelope) WithContext(ctx context.Context)
- type FormPart
- type Headers
- type InlinePart
- type Mail
Constants ¶
const MimeApplicationOctet = "application/octet-stream"
MimeApplicationOctet is a generic type for binary data when a more specific type is unknown.
const MimeApplicationPdf = "application/pdf"
MimeApplicationPdf is used for PDF document attachments.
const MimeApplicationPgpEncrypted = "application/pgp-encrypted"
MimeApplicationPgpEncrypted is found within the multipart/encrypted part, specifying the encryption method for PGP/MIME encrypted messages.
const MimeApplicationPgpSignature = "application/pgp-signature"
MimeApplicationPgpSignature is used for PGP/MIME digitally signed messages. This contains the digital signature.
const MimeApplicationPkcs7Mime = "application/pkcs7-mime"
MimeApplicationPkcs7Mime is used for S/MIME encrypted or signed messages.
const MimeImageGif = "image/gif"
MimeImageGif is used for GIF image attachments or inline images.
const MimeImageJpeg = "image/jpeg"
MimeImageJpeg is used for JPEG image attachments or inline images.
const MimeImagePng = "image/png"
MimeImagePng is used for PNG image attachments or inline images.
const MimeMessageDeliveryStatus = "message/delivery-status"
MimeMessageDeliveryStatus is used for Delivery Status Notifications (DSNs), providing information about the delivery status of an email.
const MimeMessageDispositionNotification = "message/disposition-notification"
MimeMessageDispositionNotification is used for Message Disposition Notifications (MDNs), indicating the recipient's handling of the message (e.g., displayed, deleted).
const MimeMessageEmail = "message/rfc822"
MimeMessageEmail (message/rfc822) is used to embed entire email messages as attachments. It includes all headers and the body of the embedded email.
const MimeMultipartAlternative = "multipart/alternative"
MimeMultipartAlternative is used for presenting the same content in different formats. The client can choose the most appropriate format to display (e.g., plain text or HTML).
const MimeMultipartEncrypted = "multipart/encrypted"
MimeMultipartEncrypted is used for PGP/MIME encrypted messages. It typically contains two parts: the version information and the encrypted data.
const MimeMultipartMixed = "multipart/mixed"
MimeMultipartMixed is used for messages with multiple parts of different types. It allows combining different content types in a single message, such as text and attachments.
const MimeMultipartRelated = "multipart/related"
MimeMultipartRelated is used for messages with inline content, like HTML with embedded images. It groups related parts that should be considered as a single unit.
const MimeMultipartSigned = "multipart/signed"
MimeMultipartSigned is used for digitally signed emails. It contains two parts: the original message content and the digital signature.
const MimeTextCalendar = "text/calendar"
MimeTextCalendar is used for iCalendar data, allowing the inclusion of calendar events.
const MimeTextEnriched = "text/enriched"
MimeTextEnriched is an obsolete format for rich text, predating HTML in emails.
const MimeTextHtml = "text/html"
MimeTextHtml is used for HTML-formatted content, allowing rich text and formatting.
const MimeTextPlain = "text/plain"
MimeTextPlain is used for plain text content without any formatting.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachmentPart ¶ added in v0.3.7
type AttachmentPart struct {
// contains filtered or unexported fields
}
func (*AttachmentPart) Filename ¶ added in v0.3.7
func (a *AttachmentPart) Filename() (string, error)
type Content ¶ added in v0.3.7
type Content struct {
Headers textproto.MIMEHeader
Body []byte
Children []Content
}
func (*Content) AsAttachment ¶ added in v0.3.7
func (c *Content) AsAttachment() (*AttachmentPart, error)
func (*Content) AsInline ¶ added in v0.3.7
func (c *Content) AsInline() (*InlinePart, error)
func (*Content) IsAttachment ¶ added in v0.3.7
type DecodingOption ¶ added in v0.4.0
type DecodingOption func(*decodingConfig)
func WithLiteral ¶ added in v0.4.0
func WithLiteral() DecodingOption
WithLiteral will not encode the headers to utf-8, just read them as MIMEHeader
func WithQuoteEscape ¶ added in v0.4.0
func WithQuoteEscape(headers ...string) DecodingOption
func WithQuoteNone ¶ added in v0.4.0
func WithQuoteNone() DecodingOption
type Envelope ¶
type Envelope struct {
// Remote IP address
RemoteAddr net.Addr
// Message sent in EHLO command
Helo string
// TLS is true if the email was received using a TLS connection
TLS bool
// UTF8
UTF8 bool
// ESMTP: true if EHLO was used
ESMTP bool
// Sender
MailFrom *mail.Address
// Recipients
RcptTo []*mail.Address
// Data stores the header and message body
Data *Data
// contains filtered or unexported fields
}
Envelope of Email represents a single SMTP message.
func (*Envelope) ConnectionId ¶
func (*Envelope) EnvelopeId ¶
func (*Envelope) Mail ¶
Mail will "Open" the envelope and return the mail inside it. Ie the Header and Body
func (*Envelope) PrependHeader ¶
PrependHeader adds a header to Data in the envelope, operates on the Data buffer
func (*Envelope) WithContext ¶
type Headers ¶ added in v0.3.7
type Headers struct {
textproto.MIMEHeader
}
type InlinePart ¶ added in v0.3.7
type InlinePart struct {
// contains filtered or unexported fields
}
func (*InlinePart) Filename ¶ added in v0.3.7
func (a *InlinePart) Filename() (string, error)