Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrorParamsEmpty errors.CodeError = iota + errors.MIN_PKG_SMTP ErrorFileStat ErrorFileRead ErrorConfigInvalidDSN ErrorConfigInvalidNetwork ErrorConfigInvalidParams ErrorConfigInvalidHost ErrorSMTPDial ErrorSMTPSend ErrorSMTPClientInit ErrorSMTPClientStartTLS ErrorSMTPClientAuth ErrorSMTPClientNoop ErrorSMTPClientMail ErrorSMTPClientRcpt ErrorSMTPClientData ErrorSMTPClientEmpty ErrorSMTPClientSendRecovered ErrorSMTPClientEmptyFrom ErrorSMTPClientEmptyTo ErrorSMTPClientEmptySubject ErrorSMTPClientEmptyMailer ErrorRandReader ErrorBufferEmpty ErrorBufferWriteString ErrorBufferWriteBytes ErrorIOWriter ErrorIOWriterMissing ErrorEmptyHtml ErrorEmptyContents ErrorTemplateParsing ErrorTemplateExecute ErrorTemplateClone ErrorTemplateHtml2Text )
View Source
const (
ADDRESS_MIN_SIZE = 7
)
Variables ¶
This section is empty.
Functions ¶
func IsCodeError ¶
func IsCodeError() bool
func NewAttachmentFile ¶
func NewAttachmentFile(name string, filepath string) (Attachment, Error)
Types ¶
type Attachment ¶
type Attachment interface { Clone() Attachment GetContentType() string GetName() string GetBuffer() *bytes.Buffer Write(p []byte) (n int, e error) WriteString(s string) (n int, e error) WriteRune(r rune) (n int, e error) }
func NewAttachment ¶
func NewAttachment(name string) Attachment
type ContentType ¶
type ContentType uint8
const ( CONTENTTYPE_MIXED ContentType = iota CONTENTTYPE_ALTERNATIVE CONTENTTYPE_HTML CONTENTTYPE_TEXT )
func (ContentType) String ¶
func (c ContentType) String() string
type IOData ¶
type IOData interface { ContentType(ct ContentType, charset string) errors.Error Header(key, value string) errors.Error String(value string) errors.Error Bytes(value []byte) errors.Error CRLF() errors.Error Send() errors.Error GetBuffer() *bytes.Buffer AttachmentStart(c ContentType) errors.Error AttachmentAddFile(contentType, attachmentName string, attachment *bytes.Buffer) errors.Error AttachmentAddBody(m MailTemplate, ct ContentType) errors.Error AttachmentEnd() errors.Error }
type ListMailAddress ¶
type ListMailAddress interface { Len() int IsEmpty() bool String() string Clone() ListMailAddress Merge(list ListMailAddress) Slice() []MailAddress AddressOnly() string Add(adr ...MailAddress) AddParseEmail(m ...string) AddNewEmail(name, addr string) }
func NewListMailAddress ¶
func NewListMailAddress() ListMailAddress
type MailAddress ¶
type MailAddress interface { Clone() MailAddress ForceName(name string) ForceAddress(address string) String() string AddressOnly() string }
func MailAddressParser ¶
func MailAddressParser(str string) MailAddress
func NewMailAddress ¶
func NewMailAddress(name, address string) MailAddress
type MailTemplate ¶
type MailTemplate interface { Clone() (MailTemplate, errors.Error) IsEmpty() bool SetCharset(char string) GetCharset() string SetTextOption(opt html2text.Options) GetTextOption() html2text.Options GetBufferHtml(data interface{}) (*bytes.Buffer, errors.Error) GetBufferText(data interface{}) (*bytes.Buffer, errors.Error) GetBufferRich(data interface{}) (*bytes.Buffer, errors.Error) RegisterData(data interface{}) }
func NewMailTemplate ¶
func NewMailTemplate(name, tpl string, isFile bool) (MailTemplate, errors.Error)
type SMTP ¶
type SMTP interface { Client() (*smtp.Client, errors.Error) Close() Check() errors.Error Clone() SMTP ForceHost(host string) ForcePort(port int) ForceUser(user string) ForcePass(pass string) ForceNet(mode NETMode) ForceTls(mode TLSMode) ForceTLSSkipVerify(skip bool) ForceTLSServerName(serverName string) GetDsn() string }
func NewSMTP ¶
NewSMTP return a SMTP interface to operation negotiation with a SMTP server. the dsn parameter must be string like this '[user[:password]@][net[(addr)]]/tlsmode[?param1=value1¶mN=valueN]".
- params available are : ServerName (string), SkipVerify (boolean).
- tls mode acceptable are : starttls, tls, <any other value to no tls/startls>.
- net aceeptable are : tcp4, tcp6, unix.
type SendMail ¶
type SendMail interface { SetListTo(listMail ListMailAddress) GetToString() string SetTo(mail ...MailAddress) AddTo(mail ...MailAddress) SetListCc(listMail ListMailAddress) SetCc(mail ...MailAddress) AddCc(mail ...MailAddress) SetListBcc(listMail ListMailAddress) SetBcc(mail ...MailAddress) AddBcc(mail ...MailAddress) SetFrom(mail MailAddress) SetReplyTo(mail MailAddress) SetSubject(subject string) SetHtml(m MailTemplate) HtmlRegisterData(data interface{}) SetBody(p *bytes.Buffer) SetForceOnly(ct ContentType) AddAttachment(a ...Attachment) SetMessageId(id string) SetMailer(mailer string) NJSMailer(version version.Version) SetTestMode(enable bool) Clone() (SendMail, errors.Error) Send(cli *smtp.Client) (err errors.Error, buff *bytes.Buffer) SendSMTP(cli SMTP) (err errors.Error, buff *bytes.Buffer) }
func NewSendMail ¶
func NewSendMail() SendMail
Click to show internal directories.
Click to hide internal directories.