github.com/decred/politeia@v1.4.0/politeiawww/legacy/mail/mail.go (about) 1 // Copyright (c) 2020-2021 The Decred developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package mail 6 7 import "github.com/google/uuid" 8 9 // Mailer provides an API for interacting with the smtp server. 10 type Mailer interface { 11 // IsEnabled determines if the smtp server is enabled or not. 12 IsEnabled() bool 13 14 // SendTo sends an email to a list of recipient email addresses. 15 // This function does not rate limit emails and a recipient does 16 // does not need to correspond to a politeiawww user. This function 17 // can be used to send emails to sysadmins or similar cases. 18 SendTo(subject, body string, recipients []string) error 19 20 // SendToUsers sends an email to a list of recipient email 21 // addresses. The recipient MUST correspond to a politeiawww user 22 // in the database for the email to be sent. This function rate 23 // limits the number of emails that can be sent to any individual 24 // user over a 24 hour period. If a recipient is provided that does 25 // not correspond to a politeiawww user, the email is simply 26 // skipped. An error is not returned. 27 SendToUsers(subject, body string, recipients map[uuid.UUID]string) error 28 }