Documentation
¶
Index ¶
- Constants
- Variables
- func BoundaryValid(boundary string) bool
- func FakeTextFixedSize(n int) string
- func FormatDate(date time.Time) string
- func NewCharsetReader(charset string, input io.Reader) (io.Reader, error)
- func NewDecoder(data io.Reader, contentEncoding string) (io.Reader, string, error)
- func NewFakeMailWriterTo(bodySize int, attachSizes, embedSizes []int) (io.WriterTo, error)
- func ParseContentDisposition(in string) string
- func PrepareValue(key, value string) string
- func RandomBoundary(n int) string
- func UueDecode(w io.Writer, data []byte) (int, string, string, error)
- func UueEncode(w io.Writer, filename, perm string, d []byte) (int, error)
- type Builder
- func (m Builder) AddAlternative(contentType, body string) Builder
- func (m Builder) AddAlternativeWriter(contentType string, content []byte) Builder
- func (m Builder) Attach(filename string) (_ Builder, err error)
- func (m Builder) Embed(filename string) (_ Builder, err error)
- func (m Builder) SetBody(contentType, body string) Builder
- func (m Builder) SetCharset(charset string) Builder
- func (m Builder) SetHeader(field string, value ...string)
- func (m Builder) WriteTo(w io.Writer) (int64, error)
- type FileInfo
- type Header
- func (h Header) Add(key, value string)
- func (h Header) ContentDisposition() (string, map[string]string, error)
- func (h Header) ContentTransferEncoding() (string, map[string]string, error)
- func (h Header) ContentType() (string, map[string]string, error)
- func (h Header) Get(key string) string
- func (h Header) GetMany(key string) []string
- func (h Header) MIMEHeader() textproto.MIMEHeader
- func (h Header) Set(key, value string)
- func (h Header) SetContentType(ct string)
- func (h Header) SetMany(key string, values []string)
- func (h Header) WriteTo(w io.Writer) (int64, error)
- type LimitWriter
- type Message
- func (m *Message) AddPart(p *Part)
- func (m *Message) Bcc() ([]*mail.Address, error)
- func (m *Message) Cc() ([]*mail.Address, error)
- func (m *Message) Date() (time.Time, error)
- func (m *Message) FindChildPartWithContentType(parent *Part, ct string) (*Part, error)
- func (m *Message) From() (*mail.Address, error)
- func (m *Message) FromAsString() string
- func (m *Message) GetMainPart() (*Part, error)
- func (m *Message) GetMainPartPos() (uint, error)
- func (m *Message) GetNextOrder() int
- func (m *Message) GetPartWithOrder(order int) (*Part, error)
- func (m *Message) IsValid() (bool, error)
- func (m *Message) Subject() string
- func (m *Message) To() ([]*mail.Address, error)
- func (m *Message) ToAsString() string
- func (m *Message) WriteBodyTo(w io.Writer, order int, repair bool) (int64, error)
- func (m *Message) WriteHeadersTo(w io.Writer, order int, repair bool) (int64, error)
- func (m *Message) WriteTo(w io.Writer) (int64, error)
- func (m *Message) WriteToOrder(w io.Writer, order int) (int64, error)
- type Pair
- type Part
- type PartInfo
Constants ¶
View Source
const ( // QuotedPrintableContentEncoding represents the quoted-printable Encoding as defined in RFC 2045. QuotedPrintableContentEncoding = "quoted-printable" BinaryContentEncoding = "binary" Base64ContentEncoding = "base64" UuencodeContentEncoding = "uuencode" XUuencodeContentEncoding = "x-uuencode" XUueContentEncoding = "x-uue" SevenDashBitContentEncoding = "7-bit" SevenBitContentEncoding = "7bit" EightDashBitContentEncoding = "8-bit" EightBitContentEncoding = "8bit" NoneContentEncoding = "" BoundaryAttribute = "boundary" MultipartContentType = "multipart/" MultipartSignedContentType = MultipartContentType + "signed" MessageContentType = "message/" MessageRfc822ContentType = MessageContentType + "rfc822" TextContentType = "text/" TextPlainContentType = TextContentType + "plain" DefaultContentType = TextPlainContentType + "; charset=us-ascii" InlineDisposition = "inline" AttachmentDisposition = "attachment" NoneDisposition = "" CRLF = "\r\n" LF = "\n" TAB = "\t" DefaultBoundaryLength = 60 MinBoundaryLength = 1 MaxBoundaryLength = 69 Base64LineLength = 76 Utf8Charset = "UTF-8" FilenameParameter = "filename" NameParameter = "name" CharsetParameter = "charset" MainPartOrder = 0 )
View Source
const ( UueStart = "begin" UueSpace = " " UueEnd = "end" UueMaxLineLength = 45 UueMaxSymbolIdentifier = "M" UueBytesEncodeFactor = 3 UueBytesDecodeFactor = 4 UueOffset = 32 UueLastSymbol = "`" UueDefaultName = "data.txt" UueDefaultPerm = "0644" )
Variables ¶
View Source
var DefaultLimitWriterDelimiter = []byte(CRLF)
Functions ¶
func BoundaryValid ¶
func FakeTextFixedSize ¶
func FormatDate ¶
FormatDate форматирует дату в формате RFC 5322 (RFC1123Z).
func NewDecoder ¶
func NewFakeMailWriterTo ¶
func ParseContentDisposition ¶
func PrepareValue ¶
func RandomBoundary ¶
Types ¶
type Builder ¶
type Builder struct {
Header Header // Заголовки письма (From, To, Subject, ...)
Parts []PartInfo // Части тела (plain text, HTML и пр.)
Attachments []FileInfo // Вложения (Content-Disposition: attachment)
Embedded []FileInfo // Встроенные файлы (Content-Disposition: inline)
Charset string // Кодировка (по умолчанию UTF-8)
Encoding string // Схема кодирования (Base64 / QuotedPrintable)
}
Builder используется для пошаговой сборки MIME-сообщения. Поддерживает заголовки, body, альтернативные версии, вложения и inline-ресурсы (картинки).
func NewMessageBuilder ¶
func NewMessageBuilder() Builder
NewMessageBuilder создаёт новый объект Builder с настройками по умолчанию: - Charset: UTF-8 - Encoding: Base64
func (Builder) AddAlternative ¶
AddAlternative добавляет альтернативное тело письма (например, plain и HTML). Первой должна идти "text/plain", второй — "text/html".
func (Builder) AddAlternativeWriter ¶
AddAlternativeWriter добавляет альтернативное тело письма из []byte.
func (Builder) SetCharset ¶
SetCharset задаёт кодировку для сообщения.
type Header ¶
type Header textproto.MIMEHeader
func (Header) ContentDisposition ¶
func (Header) ContentTransferEncoding ¶
func (Header) MIMEHeader ¶
func (h Header) MIMEHeader() textproto.MIMEHeader
func (Header) SetContentType ¶
type LimitWriter ¶
type Message ¶
func NewMessage ¶
func NewMessage() *Message
func (*Message) FindChildPartWithContentType ¶
func (*Message) FromAsString ¶
func (*Message) GetMainPart ¶
func (*Message) GetMainPartPos ¶
func (*Message) GetNextOrder ¶
func (*Message) ToAsString ¶
func (*Message) WriteBodyTo ¶
func (*Message) WriteHeadersTo ¶
type Part ¶
func (*Part) ContentDisposition ¶
func (*Part) ContentTransferEncoding ¶
func (*Part) ContentType ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.