Documentation
¶
Index ¶
- Constants
- Variables
- func BuildRawMessage(fromAddr string, data EmailData, attachment *PdfAttach) ([]byte, error)
- func RenderHtmlTemplate(data any, templateBody string) (string, error)
- func RenderTextTemplate(data any, templateBody string) (string, error)
- type BatchEmailData
- type DefaultMailer
- type EmailData
- type EmailService
- type EmailServiceImpl
- type Mailer
- type PdfAttach
- type PullSlipData
Constants ¶
View Source
const DATE_LAYOUT = "2006-01-02"
View Source
const DEFAULT_FOR_NO_VALUE = "n/a"
Variables ¶
View Source
var ( SMTP_HOST = utils.GetEnv("SMTP_HOST", "") SMTP_PORT = utils.GetEnv("SMTP_PORT", "2525") SMTP_USERNAME = utils.GetEnv("SMTP_USERNAME", "") SMTP_PASSWORD = utils.GetEnv("SMTP_PASSWORD", "") )
Environment variables for SMTP configuration.
Functions ¶
func BuildRawMessage ¶
BuildRawMessage constructs a MIME multipart/mixed raw message. If attachment is non-nil its bytes are included as a PDF attachment.
Types ¶
type BatchEmailData ¶
Only string fields are allowed
func GetBatchEmailData ¶
func GetBatchEmailData(fullCount int64, actualCount int, batchQuery string) BatchEmailData
type DefaultMailer ¶
type DefaultMailer struct{}
type EmailData ¶
type EmailData struct {
To []string `json:"to"`
Subject string `json:"subject"`
Body string `json:"body"`
IsHTML bool `json:"isHtml,omitempty"`
IncludePdf bool `json:"includePdf,omitempty"`
}
EmailData carries the email payload inside an EventData.CustomData map.
type EmailService ¶
type EmailServiceImpl ¶
type EmailServiceImpl struct {
// contains filtered or unexported fields
}
func NewEmailService ¶
func NewEmailService() *EmailServiceImpl
func (*EmailServiceImpl) IsReadyToSend ¶
func (s *EmailServiceImpl) IsReadyToSend() bool
type Mailer ¶
type Mailer interface {
SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) error
}
Mailer is an interface over smtp.SendMail, allowing mocking in tests.
type PullSlipData ¶
type PullSlipData struct {
ReqId string
PickupLocation string
Title string
Author string
DueDate string
ReturnAddress string
BarcodeBase64 string
ServiceType string
ServiceLevel string
SystemIdentifier string
Publisher string
Volume string
Issue string
Pages string
StaffNotes string
CallNumber string
LoanConditions string
PatronName string
PatronSurname string
PatronId string
}
Only string fields are allowed
func GetPullSlipData ¶
func GetPullSlipData(pr pr_db.PatronRequest, notes []pr_db.Notification, conditions []pr_db.Notification, barcodeData string) PullSlipData
Click to show internal directories.
Click to hide internal directories.