gosparkpost
gosparkpost copied to clipboard
Fix sending Transmission content with template_id.
Current logic is flawed in 2 ways.
- Iterating over a Golang map is not deterministic
- Other data types are actually valid to pass into message such as CC and BCC which are
map[string]stringtypes. Logic would early return when it foundtemplate_idbased on [1], but because iterating keys over a map is not deterministic, it would fetchCCand then err out because it'smap[string]stringnotstring
I came here to report the same problem and propose a similar fix. @Tang8330 were you able to find a workaround so you can reliably send your transmissions? Otherwise calls to transmission.ParseContent(...) will randomly fail. (Due to a map's keys always being returned in an "indeterminate" ordering.)
It seems like the only(?) workaround for using stored templates with Sparkpost is to simply not use this Golang library?
@chrsmith I fixed the problem on my fork and we're using that in Production.