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

Simple Java Mail Wishlist -- clearRecipients() #90

Closed
dormitionskete opened this issue Aug 14, 2017 · 4 comments
Closed

Simple Java Mail Wishlist -- clearRecipients() #90

dormitionskete opened this issue Aug 14, 2017 · 4 comments
Labels

Comments

@dormitionskete
Copy link

I recently became acquainted with SimpleJavaMail. I've been testing it for a few days, and so far, I like it very much. Thank you very much for making it, and sharing it with us!

On your website, you asked for suggestions for how it could be improved. I have a few "wishlist" items for it. I'll put them in separate tickets so you can evaluate and track them individually.


Please add a way to clear the recipient list so the email object can be reused without having to reset all of the other fields:

email.clearRecipients();

If this was implemented, we could create the email once, add some recipients, send it, clear the recipients, add more recipients, send it again, etc. That would be very useful for bulk mailings where you don't want a lot of recipients, lest it be considered spam.

@bbottema
Copy link
Owner

I'm on the fence on this one. If you add clearRecipients() why not 'clearHTMLBody()' or 'clearSubject()', clearAttachments().

Moreover, if you use the EmailBuilder, you can configure it once without recipients, then use it multiple times to build the same email:

EmailBuilder emailBuilder = new EmailBuilder()
    .from("sender", "sender@domain.com")
    .subject("your subject")
    (..);

Email email1 = emailBuilder.build();
Email email2 = emailBuilder.build();

@dormitionskete
Copy link
Author

Ok. That would work. Thank you! That didn't occur to me.

We send out weekly newsletters, sending the same message, but sending it out as a separate email to each "AddressData" record in the group. Each of these records can have up to two email addresses, and in those cases, it's sent to both as one email. And it works well for us. In the past, when we sent them BCC to over 100 recipients, it'd be treated as spam by some people's servers / email clients. Since we started sending them this way, that has not been a problem.

I was thinking it'd be nice to create the Email object once, clear the recipients each time, etc. But creating an EmailBuilder object, and reusing it would accomplish the same thing.

Thank you again for your time and attention to this matter!

And thanks again for sharing this great project. I appreciate it.

@bbottema
Copy link
Owner

bbottema commented Aug 14, 2017

With your use case, I just realized that there's a bug with the EmailBuilder: #94. Currently this is blocking reuse of a single builder.

I'll get that fixed asap. Until then I will keep this issue open.

@dormitionskete
Copy link
Author

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants