Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Email ¶
type Email struct { Recipients []string // Recipients of the email Subject string // Subject of the email Body string // Body of the email TemplateFileName string // Name of the template file Data map[string]interface{} // Data to be parsed with the template }
Email is a struct that contains the email data.
If data is provided, the template will be parsed with the data. Otherwise, the template will be parsed with the struct below. Ensure that the data keys match the template placeholders.
struct { Title string // Title of the email Body string // Body of the email }
type EmailAuthConfig ¶
type EmailAuthConfig struct { Host string // Host of the email provider Port int // Port of the email provider Username string // Username of the email provider Password string // Password of the email provider From string // From address as the sender of the email }
EmailAuthConfig is a struct that contains the email authentication data. You can get the host, port, username and password from the email provider.
Example:
EmailAuthConfig{ Host: "smtp.gmail.com", Port: 587, Username: "user", Password: "password", From: "me@gmail.com", }
type GoemailConfig ¶
type GoemailConfig struct { Config EmailAuthConfig TemplateDir string Log bool // contains filtered or unexported fields }
func (*GoemailConfig) SendEmail ¶
func (g *GoemailConfig) SendEmail(mail *Email) error
type Gomail ¶
type Gomail interface { // SendEmail sends an email to the specified recipients with the given subject, template, and data. SendEmail(mail *Email) error // contains filtered or unexported methods }
Goemail is an interface for sending emails and parsing templates.
func NewGomail ¶
func NewGomail(auth EmailAuthConfig, templateDir string) Gomail
NewGomail creates a new Gomail instance with the given email authentication configuration and template directory.
type ValidateKind ¶
type ValidateKind string
Click to show internal directories.
Click to hide internal directories.