service

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSMTPAddress

func BuildSMTPAddress(smtpHost string, smtpPort int) string

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

func ExecSendMail(addr string, auth smtp.Auth, from string, to []string, msg []byte) (bool, error)

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

func MountAndSendMail(to []string, message []byte) (bool, error)

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

func SaveConfig(Host string, Port int, Email string, Password string) error

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

func SetupInitAuth(email, password, smtpHost string) smtp.Auth

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL