Documentation ¶
Index ¶
- type Client
- func (c *Client) Mailing(emails []string, message string, subject string, contentType string) error
- func (c *Client) PersonalMailing(values map[string][]interface{}, template string, subject string, ...) error
- func (c *Client) Send(to string, message string, subject string, contentType string) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an email client that can send emails using the specified configuration.
func New ¶
New creates a new Client instance using the provided configuration. It initializes the Client with the host, port, username, password, and identity.
func (*Client) Mailing ¶ added in v1.0.8
Mailing sends a message to a list of recipients with the given message, subject, and content type.
func (*Client) PersonalMailing ¶ added in v1.0.8
func (c *Client) PersonalMailing(values map[string][]interface{}, template string, subject string, contentType string) error
PersonalMailing sends a message to a list of recipients substituting values into given template. The template format should be the same as for fmt`s functions. The values are taken from a multiple, where the key is the recipient's mail, and the value is an array of values that will be substituted into the template. Be careful with the order of values in the template and the array of values.
type Config ¶
type Config struct { Host string `yaml:"host" env:"MAIL_HOST"` // The SMTP server hostname Port int `yaml:"port" env:"MAIL_PORT"` // The SMTP server port Username string `yaml:"username" env:"MAIL_USERNAME"` // The username for authentication Password string `env:"MAIL_PASSWORD" ` // The password for authentication Identity string `yaml:"identity" env:"MAIL_IDENTITY"` // The identity of the sender }
Config holds the configuration for the email client. It includes fields for the mail server host, port, username, password, and identity.