Skip to content

Commit bf823c1

Browse files
committed
add: Support send_each_at mail header
1 parent 662f388 commit bf823c1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

helpers/mail/mail_v3.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type Personalization struct {
5252
DynamicTemplateData map[string]interface{} `json:"dynamic_template_data,omitempty"`
5353
Categories []string `json:"categories,omitempty"`
5454
SendAt int `json:"send_at,omitempty"`
55+
SendEachAt []int `json:"send_each_at,omitempty"`
5556
}
5657

5758
// Email holds email name and address info
@@ -369,6 +370,11 @@ func (p *Personalization) SetSendAt(sendAt int) {
369370
p.SendAt = sendAt
370371
}
371372

373+
// SetSendEactAt ...
374+
func (p *Personalization) SetSendEactAt(sendEachAt []int) {
375+
p.SendEachAt = sendEachAt
376+
}
377+
372378
// NewAttachment ...
373379
func NewAttachment() *Attachment {
374380
return &Attachment{}

helpers/mail/mail_v3_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,18 @@ func TestV3PersonalizationSetSendAt(t *testing.T) {
380380
assert.Equal(t, sendAt, p.SendAt, fmt.Sprintf("sendat should be %d, got %d", sendAt, p.SendAt))
381381
}
382382

383+
func TestV3PersonalizationSetSendEachAt(t *testing.T) {
384+
sendAts := []int{
385+
time.Now().Second(),
386+
time.Now().AddDate(0, 0, 1).Second(),
387+
}
388+
389+
p := NewPersonalization()
390+
p.SetSendEactAt(sendAts)
391+
392+
assert.Equal(t, len(sendAts), len(p.SendEachAt), fmt.Sprintf("length of SendEactAt should be %d, got %d", len(sendAts), len(p.SendEachAt)))
393+
}
394+
383395
func TestV3NewAttachment(t *testing.T) {
384396
assert.NotNil(t, NewAttachment(), "NewAttachment() shouldn't return nil")
385397
}

0 commit comments

Comments
 (0)