sendgrid-rs icon indicating copy to clipboard operation
sendgrid-rs copied to clipboard

Personalization requires at least one email which isn't convenient

Open 0x8f701 opened this issue 4 years ago • 2 comments

0x8f701 avatar Nov 15 '20 20:11 0x8f701

I just noticed that since certain commit, Personalization needs to provide at least one email, this isn't convenient.

Because in one email we often have multiple receivers, it's normal to build an empty Personalization and then loop through the list of receivers.

However, with the latest change, we need to do:

let mut p = Personalization::new(Email::new(receivers.remove(0))

p.add_to(..)

comparing to:

let mut p = Personalization::new()

p.add_to(..)

0x8f701 avatar Nov 15 '20 20:11 0x8f701

Hey, sorry that this is a little bit of a paper cut for the API. I'd be willing to add an Email::many API that accepts a vector of receivers if that would help.

gsquire avatar Nov 21 '20 21:11 gsquire