Documentation ¶
Index ¶
- func BuildSMTPAddress(smtpHost string, smtpPort int) string
- func CheckEnvironment() bool
- func ExecSendMail(addr string, auth smtp.Auth, from string, to []string, msg []byte) (bool, error)
- func MountAndSendMail(to []string, message []byte) (bool, error)
- func SaveConfig(Host string, Port int, Email string, Password string) error
- func SaveConfigDb(config domain.SMTPConfig) error
- func SetupInitAuth(email, password, smtpHost string) smtp.Auth
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSMTPAddress ¶
BuildSMTPAddress returns the SMTP address string.
It takes in the SMTP host and port as parameters and returns a formatted string in the format "host:port".
Parameters: - smtpHost: the SMTP host as a string. - smtpPort: the SMTP port as an integer.
Returns: - The SMTP address as a formatted string.
func CheckEnvironment ¶
func CheckEnvironment() bool
checkEnvironment checks the environment and returns a boolean value.
This function does not take any parameters. It returns a boolean value indicating whether the "DATABASE_TYPE" environment variable is set or not.
func ExecSendMail ¶
ExecSendMail sends an email using the provided SMTP server address, authentication, sender and recipient addresses, and message.
Parameters: - addr: the address of the SMTP server to use. - auth: the authentication mechanism to use when connecting to the SMTP server. - from: the sender's email address. - to: a list of recipient email addresses. - msg: the message to be sent.
Returns: - bool: a boolean value indicating whether the email was sent successfully or not. - error: an error object if there was an error sending the email.
func MountAndSendMail ¶
MountAndSendMail sends an email using the provided SMTP configuration.
It takes in two parameters:
- to: a slice of strings representing the recipients of the email.
- message: a byte array containing the content of the email.
It returns a boolean value indicating whether the email was sent successfully, and an error if any.
func SaveConfig ¶
SaveConfig saves the SMTP configuration to the database.
Parameters: - Host: the host of the SMTP server. - Port: the port number of the SMTP server. - Email: the email address to use for authentication. - Password: the password to use for authentication.
Returns: - error: an error if there was a problem saving the configuration.
func SaveConfigDb ¶
func SaveConfigDb(config domain.SMTPConfig) error
SaveLog saves the SMTP configuration to the database.
It takes a domain.SMTPConfig parameter and returns an error.
func SetupInitAuth ¶
SetupInitAuth returns an smtp.Auth implementation using plain authentication.
It takes the following parameters: - email: the email address to use for authentication - password: the password to use for authentication - smtpHost: the SMTP server host
It returns an smtp.Auth object.
Types ¶
This section is empty.