Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package mailer acts a central mail server for the application.
It implements various types of communication with actual mail servers (sendmail, smtp, sendgrid API) and a simple queue mechanism to avoid spamming these servers.
Index ¶
Constants ¶
      View Source
      
  
const (
	// MaxSendRetries defines number of retries in case of connection failure.
	MaxSendRetries = 5
)
    Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoltQueue ¶
type BoltQueue struct {
	// For Testing purpose : delete file after closing
	DeleteOnClose bool
	// Path to the DB file
	DbPath string
	// contains filtered or unexported fields
}
    BoltQueue defines a queue for the mails backed by a Bolt DB.
func NewBoltQueue ¶
NewBoltQueue creates a Bolt DB if necessary.
func (*BoltQueue) Close ¶
Close closes the DB and delete corresponding file if deleteOnClose flag as been set on creation.
func (*BoltQueue) Consume ¶
Consume acquires the lock and send mails that are in the queue by batches, sending at most 100 mails by batch.
type NoOpSender ¶
type NoOpSender struct {
	// contains filtered or unexported fields
}
    func (*NoOpSender) Check ¶
func (n *NoOpSender) Check(ctx context.Context) error
func (*NoOpSender) Configure ¶
func (*NoOpSender) Send ¶
func (n *NoOpSender) Send(email *mailer.Mail) error
type Queue ¶
type SendGrid ¶
type SendGrid struct {
	ApiKey string
}
    SendGrid is a passerelle to Sendgrid API. It holds the application API Key.
func (*SendGrid) Configure ¶
Configure expects a valid sendgrid API key.
type Sender ¶
      
      Source Files
      ¶
    
- boltQueue.go
 - dao.go
 - gomail.go
 - memqueue.go
 - sender-noop.go
 - sender-sendgrid.go
 - sender-sendmail.go
 - sender-smtp.go
 - templates.go
 
      
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| 
       Package grpc provides the actual logic for posting emails to queue or to mail servers 
         | 
      Package grpc provides the actual logic for posting emails to queue or to mail servers | 
| 
       Package lang provides i18n strings for mailer-related data. 
         | 
      Package lang provides i18n strings for mailer-related data. | 
| 
       Package rest exposes a simple API for posting emails 
         | 
      Package rest exposes a simple API for posting emails | 
| 
       Package templates defines ready-to-use templates to send email in a nice formatting. 
         | 
      Package templates defines ready-to-use templates to send email in a nice formatting. | 
 Click to show internal directories. 
   Click to hide internal directories.