Skip to content

Commit

Permalink
Merge pull request #44 from joeirimpan/tx
Browse files Browse the repository at this point in the history
feat: Add from_email to postback struct
  • Loading branch information
joeirimpan authored Dec 12, 2023
2 parents 9c42710 + 1729f7d commit 18c19ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

type postback struct {
Subject string `json:"subject"`
FromEmail string `json:"from_email"`
ContentType string `json:"content_type"`
Body string `json:"body"`
Recipients []recipient `json:"recipients"`
Expand Down Expand Up @@ -86,6 +87,7 @@ func handlePostback(w http.ResponseWriter, r *http.Request) {

rec := data.Recipients[0]
message := messenger.Message{
From: data.FromEmail,
Subject: data.Subject,
ContentType: data.ContentType,
Body: []byte(data.Body),
Expand Down
7 changes: 6 additions & 1 deletion messenger/ses.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ func (s sesMessenger) Push(msg Message) error {
}
}

fromEmail := msg.From
if msg.Campaign != nil {
fromEmail = msg.Campaign.FromEmail
}

email := smtppool.Email{
From: msg.Campaign.FromEmail,
From: fromEmail,
To: []string{msg.Subscriber.Email},
Subject: msg.Subject,
Sender: msg.From,
Expand Down

0 comments on commit 18c19ea

Please sign in to comment.