Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add track links #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions email.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ import (
"time"
)

// TrackLinksOption are possible options for TrackLinks
type TrackLinksOption string

const (
// NoneTrackLinks means no tracking for any links in html or text bodies.
NoneTrackLinks = TrackLinksOption("None")

// HTMLAndTextTrackLinks means tracking for any links in html and text bodies.
HTMLAndTextTrackLinks = TrackLinksOption("HtmlAndText")

// HTMLOnlyTrackLinks means tracking for any links only in html bodies.
HTMLOnlyTrackLinks = TrackLinksOption("HtmlOnly")

// TextOnlyrackLinks means tracking for only links only in text bodies.
TextOnlyrackLinks = TrackLinksOption("TextOnly")
)

// Email is exactly what it sounds like
type Email struct {
// From: REQUIRED The sender email address. Must have a registered and confirmed Sender Signature.
Expand All @@ -27,6 +44,11 @@ type Email struct {
ReplyTo string `json:",omitempty"`
// Headers: List of custom headers to include.
Headers []Header `json:",omitempty"`

// TrackLinks: Activate link tracking for links in the HTML or Text bodies of this email.
// Possible options: None HtmlAndText HtmlOnly TextOnly
TrackLinks TrackLinksOption `json:",omitempty"`

// TrackOpens: Activate open tracking for this email.
TrackOpens bool `json:",omitempty"`
// Attachments: List of attachments
Expand Down
1 change: 1 addition & 0 deletions email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var testEmail = Email{
},
},
TrackOpens: true,
TrackLinks: HTMLAndTextTrackLinks,
Attachments: []Attachment{
{
Name: "readme.txt",
Expand Down