Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrorParamsEmpty errors.CodeError = iota + errors.MinPkgMail ErrorMailConfigInvalid ErrorMailIORead ErrorMailIOWrite ErrorMailDateParsing ErrorMailSmtpClient ErrorMailSenderInit )
View Source
const ( RecipientTo recipientType = iota RecipientCC RecipientBCC )
View Source
const (
DateTimeLayout = time.RFC1123Z
)
Variables ¶
This section is empty.
Functions ¶
func IsCodeError ¶
func IsCodeError() bool
Types ¶
type Body ¶
type Body struct {
// contains filtered or unexported fields
}
contents represents the different content parts of an email body.
type Config ¶ added in v1.8.1
type Config struct { Charset string `json:"charset" yaml:"charset" toml:"charset" mapstructure:"charset" validate:"required"` Subject string `json:"subject" yaml:"subject" toml:"subject" mapstructure:"subject" validate:"required"` Encoding string `json:"encoding" yaml:"encoding" toml:"encoding" mapstructure:"encoding" validate:"required"` Priority string `json:"priority" yaml:"priority" toml:"priority" mapstructure:"priority" validate:"required"` Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty" toml:"headers,omitempty" mapstructure:"headers,omitempty"` From string `json:"from" yaml:"from" toml:"from" mapstructure:"from" validate:"required,email"` Sender string `json:"sender,omitempty" yaml:"sender,omitempty" toml:"sender,omitempty" mapstructure:"sender,omitempty" validate:"email"` ReplyTo string `json:"replyTo,omitempty" yaml:"replyTo,omitempty" toml:"replyTo,omitempty" mapstructure:"replyTo,omitempty" validate:"email"` ReturnPath string `` /* 136-byte string literal not displayed */ To []string `json:"to,omitempty" yaml:"to,omitempty" toml:"to,omitempty" mapstructure:"to,omitempty" validate:"email"` Cc []string `json:"cc,omitempty" yaml:"cc,omitempty" toml:"cc,omitempty" mapstructure:"cc,omitempty" validate:"email"` Bcc []string `json:"bcc,omitempty" yaml:"bcc,omitempty" toml:"bcc,omitempty" mapstructure:"bcc,omitempty" validate:"email"` Attach []ConfigFile `json:"attach,omitempty" yaml:"attach,omitempty" toml:"attach,omitempty" mapstructure:"attach,omitempty"` Inline []ConfigFile `json:"inline,omitempty" yaml:"inline,omitempty" toml:"inline,omitempty" mapstructure:"inline,omitempty"` }
type ConfigFile ¶ added in v1.8.1
type ConfigFile struct { Name string `json:"name" yaml:"name" toml:"name" mapstructure:"name" validate:"required"` Mime string `json:"mime" yaml:"mime" toml:"mime" mapstructure:"mime" validate:"required"` Path string `json:"path" yaml:"path" toml:"path" mapstructure:"path" validate:"required,file"` }
type ContentType ¶
type ContentType uint8
const ( // ContentPlainText sets body type to text/plain in message body. ContentPlainText ContentType = iota // ContentHTML sets body type to text/html in message body. ContentHTML )
func (ContentType) String ¶
func (c ContentType) String() string
type Email ¶
type Email interface { SetFrom(mail string) GetFrom() string SetSender(mail string) GetSender() string SetReplyTo(mail string) GetReplyTo() string SetReturnPath(mail string) GetReturnPath() string SetRecipients(rt recipientType, rcpt ...string) AddRecipients(rt recipientType, rcpt ...string) GetRecipients(rt recipientType) []string }
type Encoding ¶
type Encoding uint8
const ( // EncodingNone turns off encoding on the message body. EncodingNone Encoding = iota // EncodingBinary is equal to EncodingNone, but string is set to binary instead of none. EncodingBinary // EncodingBase64 sets the message body encoding to base64. EncodingBase64 // EncodingQuotedPrintable sets the message body encoding to quoted-printable. EncodingQuotedPrintable )
func ParseEncoding ¶ added in v1.8.1
type File ¶
type File struct {
// contains filtered or unexported fields
}
file represents the files that can be added to the email message.
type Mail ¶
type Mail interface { Clone() Mail SetCharset(charset string) GetCharset() string SetPriority(p Priority) GetPriority() Priority SetSubject(subject string) GetSubject() string SetEncoding(enc Encoding) GetEncoding() Encoding SetDateTime(datetime time.Time) GetDateTime() time.Time SetDateString(layout, datetime string) liberr.Error GetDateString() string AddHeader(key string, values ...string) GetHeader(key string) []string GetHeaders() textproto.MIMEHeader SetBody(ct ContentType, body io.ReadCloser) AddBody(ct ContentType, body io.ReadCloser) GetBody() []Body SetAttachment(name string, mime string, data io.ReadCloser, inline bool) AddAttachment(name string, mime string, data io.ReadCloser, inline bool) AttachFile(filepath string, data io.ReadCloser, inline bool) GetAttachment(inline bool) []File Email() Email Sender() (Sender, liberr.Error) }
Click to show internal directories.
Click to hide internal directories.