keighl / mandrill

Simple package for sending emails through the Mandrill API.
Other
105 stars 29 forks source link

Empty flags are not the same as false ones. #21

Open bstein-clever opened 6 years ago

bstein-clever commented 6 years ago

There are a bunch of flag fields in the message object where not passing it as an argument is meaningfully different from passing it as false.

For example, there can be a global value set (in Mandrill) for track_opens and track_clicks, but because we "omitempty" on these fields in the json, https://github.com/keighl/mandrill/blob/master/mandrill.go#L83-L86 if set to false, they'll be removed from the Message object we send Mandrill.

This means that if I have my global default set to true, there's no way for me to turn off the click tracking for a particular email - the field will be dropped, and then Mandrill will do the global default (click tracking=true). Sad times.

I think we probably want a *bool for these, and possibly other boolean values in the message object.

keighl commented 6 years ago

Thanks, @bstein-clever, can you make a pull?

bstein-clever commented 6 years ago

Sure, made https://github.com/keighl/mandrill/pull/22 There are likely other bools that could be changed but these were the only two I needed; I didn't read the docs about any of the other.

You also might want to version bump, as this would break previous code. But I'll defer to you on that.