Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Client *smtp.Client
Functions ¶
func NewDialer ¶
func NewDialer(smtpDialer *SMTPDialer) *sender
NewDialer is a function that creates a new sender. The SMTPDialer struct is required. The SMTPDialer struct contains the dialer information for the SMTP server. SMTPDialer is used for servers that do not require authentication. It is used to create a new Sender. The fields are:
Host: The host for the SMTP server. Port: The port for the SMTP server.
func NewMessage ¶
func NewMessage(subject, body string) *message
NewMessage is a function that creates a new message. The subject and body are required. The subject and body are strings. The subject is the subject of the email message. The body is the body of the email message. The body can be in HTML format.
func NewPlainAuth ¶
func NewPlainAuth(auth *Authentication) *sender
NewPlainAuth is a function that creates a new sender. The Authentication struct is required. The Authentication struct contains the authentication information for the SMTP server. The Authentication struct is used to create a new Sender. The fields are:
Username: The username for the SMTP server. Password: The password for the SMTP server. Host: The host for the SMTP server. Port: The port for the SMTP server.
Types ¶
type AuthType ¶
type AuthType string
AuthType is a type that defines the authentication type for the sender.
type Authentication ¶
Authentication is a struct that contains the authentication information for the SMTP server. It is used to create a new Sender. The fields are:
Username: The username for the SMTP server. Password: The password for the SMTP server. Host: The host for the SMTP server. Port: The port for the SMTP server.
type IMessage ¶
type IMessage interface { ToBytes() []byte SetTo([]string) GetTo() []string SetCc([]string) GetCc() []string SetBcc([]string) GetBcc() []string SetSubject(string) GetSubject() string SetBody(string) GetBody() string SetAttachFiles(string) error GetAttachFiles() map[string][]byte }
IMessage is an interface that defines the methods for an email message. It is used to create a new message, set the To, Cc, Bcc, subject, body, and attachments. The ToBytes method converts the message to a byte array. The SetTo method sets the To field of the message. The GetTo method returns the To field of the message. The SetCc method sets the Cc field of the message. The GetCc method returns the Cc field of the message. The SetBcc method sets the Bcc field of the message. The GetBcc method returns the Bcc field of the message. The SetSubject method sets the subject of the message. The GetSubject method returns the subject of the message. The SetBody method sets the body of the message. The GetBody method returns the body of the message. The SetAttachFiles method attaches a file to the message. The GetAttachFiles method returns the attached files.
type ISender ¶
type ISender interface { SendMail(m *message) error SendMailTLS(m *message, tlsconfig *tls.Config) error }
ISender is an interface that defines the methods for a sender. It is used to create a new sender, and send an email message. The SendMail method sends an email message.
type SMTPDialer ¶
SMTPDialer is a struct that contains the dialer information for the SMTP server. SMTPDialer is used for servers that do not require authentication. It is used to create a new Sender. The fields are:
Host: The host for the SMTP server. Port: The port for the SMTP server.
If the SMTP server does not require authentication, then the Authentication struct is not needed.