Wire up sudo email form to send emails
Probably.
This commit is contained in:
parent
67a7d20f6c
commit
9cbb81f347
6 changed files with 81 additions and 26 deletions
|
|
@ -52,7 +52,7 @@ func urlUnsubscribe(email string) string {
|
|||
func sendEmailInitialContact(ctx context.Context, destination string) error {
|
||||
//data := pgtypes.HStore{}
|
||||
data := make(map[string]string, 0)
|
||||
source := config.ForwardEmailReportAddress
|
||||
source := config.ForwardEmailRMOAddress
|
||||
data["Destination"] = destination
|
||||
data["Source"] = source
|
||||
data["URLLogo"] = config.MakeURLReport("/static/img/nidus-logo-no-lettering-64.png")
|
||||
|
|
@ -78,7 +78,7 @@ func sendEmailInitialContact(ctx context.Context, destination string) error {
|
|||
Subject: subject,
|
||||
Text: text,
|
||||
To: destination,
|
||||
}, enums.CommsMessagetypeemailInitialContact)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to send email to %s: %w", err)
|
||||
|
|
|
|||
|
|
@ -70,17 +70,17 @@ func sendEmailReportConfirmation(ctx context.Context, job Job) error {
|
|||
return fmt.Errorf("Failed to render email report notification template: %w", err)
|
||||
}
|
||||
subject := fmt.Sprintf("Mosquito Report Submission - %s", report_id_str)
|
||||
err = insertEmailLog(ctx, data, j.destination(), public_id, config.ForwardEmailReportAddress, subject, templateReportNotificationConfirmationID)
|
||||
err = insertEmailLog(ctx, data, j.destination(), public_id, config.ForwardEmailRMOAddress, subject, templateReportNotificationConfirmationID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to store email log: %w", err)
|
||||
}
|
||||
resp, err := email.Send(ctx, email.Request{
|
||||
From: config.ForwardEmailReportAddress,
|
||||
From: config.ForwardEmailRMOAddress,
|
||||
HTML: html,
|
||||
Subject: subject,
|
||||
Text: text,
|
||||
To: j.destination(),
|
||||
}, enums.CommsMessagetypeemailReportNotificationConfirmation)
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to send email report confirmation to %s for report %s: %w", j.dest, j.reportID, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue