3 ms·
Looks interesting. A couple suggestions: 1. People have already suggested this, but it would make more sense to make users call email.New() rather than email.N
by dradtke 13y ago
Looks interesting. A couple suggestions:
1. People have already suggested this, but it would make more sense to make users call email.New() rather than email.NewEmail().
2. Alternatively, since the user will be populating a bunch of values anyway, it might make more sense to tell users to create a message like
e := &email.Email{
From: "Jordan Wright <test@gmail.com>",
To: []string{"test@example.com"},
...
}
and then, if a value hasn't been set for it, use a default value for Headers in the send method.
- jwcrux 13y agoWith regards to 1, it seems like I'm stuck between a rock and a hard place. I originally made the package in accordance to the docs I read which stated that if you are exporting more than one type, use NewType(). Now that so many people are using the package, I'd hate to make changes that would break it unless necessary. However, with that being said, 2 might solve that issue. I'll add an example this evening showing how to also create an email in one pass using an example similar to yours. Thanks for the suggestions!