Improved feedback: Notify when the same email file is being reused, and whether or not that invite was sent to new subscribers
parent
e6aeb0158a
commit
e97f048eb6
18
main.go
18
main.go
|
@ -284,6 +284,13 @@ func blastMail(cfg *Config, logFile string, trackingFile string, audience []stri
|
|||
}
|
||||
}
|
||||
|
||||
existingReaderCount := len(sentToAddresses)
|
||||
newReaderCount := 0
|
||||
|
||||
if existingReaderCount > 0 {
|
||||
fmt.Println("Same email file specified: Sending only to new subscribers...")
|
||||
}
|
||||
|
||||
var group []string
|
||||
for _, a := range audience {
|
||||
if a == "" {
|
||||
|
@ -309,6 +316,7 @@ func blastMail(cfg *Config, logFile string, trackingFile string, audience []stri
|
|||
for i, res := range results {
|
||||
log.WriteString(fmt.Sprintf("%s: %s\n", group[i], res.Message))
|
||||
}
|
||||
newReaderCount += len(group)
|
||||
group = group[0:0]
|
||||
}
|
||||
}
|
||||
|
@ -324,6 +332,16 @@ func blastMail(cfg *Config, logFile string, trackingFile string, audience []stri
|
|||
for i, res := range results {
|
||||
log.WriteString(fmt.Sprintf("%s: %s\n", group[i], res.Message))
|
||||
}
|
||||
newReaderCount += len(group)
|
||||
}
|
||||
|
||||
if newReaderCount > 0 {
|
||||
newSubscribers := existingReaderCount > 0
|
||||
if newSubscribers {
|
||||
fmt.Printf("Sent to %d new subscribers!\n", newReaderCount)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("Not sent (no new subscribers)\n")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue