Documentation ¶
Index ¶
- Constants
- func AddDomain2Url(url string) (domain_url string)
- func Md5String(s string) string
- func RecodeText(code string) string
- func SendEmail(emailTo string, code string) error
- func Sha256Encode(value string) string
- func UploadByBuffer(filebuffer []byte, fileExt string) (string, error)
- type Attachment
- type Email
Constants ¶
View Source
const ( RECODE_OK = "0" RECODE_DBERR = "4001" RECODE_NODATA = "4002" RECODE_DATAEXIST = "4003" RECODE_DATAERR = "4004" RECODE_SESSIONERR = "4101" RECODE_LOGINERR = "4102" RECODE_PARAMERR = "4103" RECODE_USERERR = "4104" RECODE_ROLEERR = "4105" RECODE_PWDERR = "4106" RECODE_SMSERR = "4017" RECODE_REQERR = "4201" RECODE_IPERR = "4202" RECODE_THIRDERR = "4301" RECODE_IOERR = "4302" RECODE_SERVERERR = "4500" RECODE_UNKNOWERR = "4501" )
Variables ¶
This section is empty.
Functions ¶
func AddDomain2Url ¶
func RecodeText ¶
func Sha256Encode ¶
Types ¶
type Attachment ¶
type Attachment struct { Filename string Header textproto.MIMEHeader Content []byte }
Attachment is a struct representing an email attachment. Based on the mime/multipart.FileHeader struct, Attachment contains the name, MIMEHeader, and content of the attachment in question
type Email ¶
type Email struct { Auth smtp.Auth Identity string `json:"identity"` Username string `json:"username"` Password string `json:"password"` Host string `json:"host"` Port int `json:"port"` From string `json:"from"` To []string Bcc []string Cc []string Subject string Text string // Plaintext message (optional) HTML string // Html message (optional) Headers textproto.MIMEHeader Attachments []*Attachment ReadReceipt []string }
Email is the type used for email messages
func NewEMail ¶
NewEMail create new Email struct with config json. config json is followed from Email struct fields.
func (*Email) Attach ¶
Attach is used to attach content from an io.Reader to the email. Parameters include an io.Reader, the desired filename for the attachment, and the Content-Type.
func (*Email) AttachFile ¶
func (e *Email) AttachFile(args ...string) (a *Attachment, err error)
AttachFile Add attach file to the send mail
Click to show internal directories.
Click to hide internal directories.