tecsmtp

package
v0.0.0-...-dd30ea9 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendMessage

func SendMessage(config *EmailConfig, message *EmailMessage) (id string, response string, err error)

Envia un mensaje por SMTP o Mailgun, segun este la configuracion

func SendMessageMailgun

func SendMessageMailgun(config *EmailConfig, message *EmailMessage) (id string, response string, err error)

func SendSmtp

func SendSmtp(config *EmailConfig, message *EmailMessage) error

func ValidateEmailAddress

func ValidateEmailAddress(email string) bool

Valida que los caracteres en la direccion de correo sean ASCII

Types

type EmailConfig

type EmailConfig struct {
	Smtp    Smtp    `json:"smtp" bson:"smtp"`
	Mailgun Mailgun `json:"mailgun" bson:"mailgun"`
}

func (*EmailConfig) IsSmtp

func (e *EmailConfig) IsSmtp() bool

func (*EmailConfig) Validate

func (e *EmailConfig) Validate() error

type EmailMessage

type EmailMessage struct {
	From        string   `json:"from"`
	To          string   `json:"to"`
	Tos         []string `json:"tos"`
	Subject     string   `json:"subject"`
	Body        string   `json:"body"`
	Attachments []string `json:"attachments"`
	BodyHtml    string   `json:"bodyHtml"`
}

func (*EmailMessage) Validate

func (t *EmailMessage) Validate() error

type Mailgun

type Mailgun struct {
	Domain     string `json:"domain" bson:"domain"`
	PublicKey  string `json:"publicKey" bson:"publicKey"`
	PrivateKey string `json:"privateKey" bson:"privateKey"`
}

type Smtp

type Smtp struct {
	Username    string `json:"userName" bson:"userName"`
	Password    string `json:"password" bson:"password"`
	EmailServer string `json:"emailServer" bson:"emailServer"`
	Port        int    `json:"port" bson:"port"`
}

Jump to

Keyboard shortcuts

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