implement email queue

This commit is contained in:
2024-10-06 09:57:29 -05:00
parent a95c0ed9b0
commit bb915f8f0a
19 changed files with 270 additions and 46 deletions

View File

@@ -10,7 +10,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/ses/types"
)
func ResetUserEmail(userEmail Email, customerId CustomerId) error {
func ResetUserEmail(userEmail UserEmail, customerId CustomerId) error {
// Load AWS configuration
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("us-east-1"))
if err != nil {
@@ -29,7 +29,7 @@ func ResetUserEmail(userEmail Email, customerId CustomerId) error {
// Define email subject and body
subject := "nKode Reset"
htmlBody := fmt.Sprintf("<h1>Hello!</h1><p>Click the link to reset your nKode.</p><a href=\"http://%s?token=%s\">Reset nKode</a>", FrontendHost, nkodeResetJwt)
htmlBody := fmt.Sprintf("<h1>Hello!</h1><p>Click the link to reset your nKode.</p><a href=\"%s?token=%s\">Reset nKode</a>", FrontendHost, nkodeResetJwt)
// Construct the email message
input := &ses.SendEmailInput{
@@ -56,6 +56,6 @@ func ResetUserEmail(userEmail Email, customerId CustomerId) error {
}
// Output the message ID of the sent email
fmt.Printf("Email sent successfully, Message ID: %s\n", *resp.MessageId)
fmt.Printf("UserEmail sent successfully, Message ID: %s\n", *resp.MessageId)
return nil
}