smtp

package
v0.0.0-...-2e7332a Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendMailSSL

func SendMailSSL(addr string, a smtp.Auth, from string, to []string, msg []byte) error

SendMailSSL envoie un email par SSL

Types

type Config

type Config struct {
	Port int
	Host string
	SSL  bool
	Auth struct {
		User     string
		Password string
	}
}

Config configuration

func GetSMTP

func GetSMTP(source interface{}, environment string) (smtp Config, err error)

GetSMTP returns a SMTP Server configurations

type IMailService

type IMailService interface {
	Send(message string, subject string, from string, to string) error
}

IMailService interface

type MailSender

type MailSender interface {
	SendMail(from string, to []string, msg []byte) error
}

MailSender interface

type MailService

type MailService struct {
	SMTP MailSender
}

MailService send email

func NewMailService

func NewMailService(server MailSender) *MailService

NewMailService retourne un MailService

func (*MailService) Send

func (m *MailService) Send(message string, subject string, from string, to string) (err error)

Send envoie un email

type SMTP

type SMTP struct {
	// contains filtered or unexported fields
}

SMTP SMTP server

func NewSMTP

func NewSMTP(filename string, environment string) (s *SMTP, err error)

NewSMTP create new SMTP

func (*SMTP) SendMail

func (s *SMTP) SendMail(from string, to []string, msg []byte) (err error)

SendMail send an email

type SMTPEnvironment

type SMTPEnvironment struct {
	Env map[string]Config
}

SMTPEnvironment configurations

func (*SMTPEnvironment) GetEnvironment

func (se *SMTPEnvironment) GetEnvironment(environment string) interface{}

GetEnvironment returns a SMTP Server configuration for the specified environment in parameter

func (*SMTPEnvironment) UnmarshalYAML

func (se *SMTPEnvironment) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements Unmarshaler. Avoid use of env in the YAML file.

Jump to

Keyboard shortcuts

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