sargue / mailgun

Java library to easily send emails using the Mailgun service
MIT License
153 stars 40 forks source link

Add sender parameter to Configuration #21

Closed ofirmiron closed 7 years ago

ofirmiron commented 7 years ago

Whenever I sent emails using this library, my email client showed that I was sending emails "on behalf of" someone else. john=foo.com@mail.bar.com on behalf of John Smith <john@foo.com>

To fix this, I had to add a sender parameter Mail.using(configuration).parameter("h:sender", "John Smith <john@foo.com>)

It would be nice if there was a Java method call in the Configuration builder instead of this.

sargue commented 7 years ago

Hi.

Thanks for the suggestion. Seems like a good addition. As soon as I have some time I will add it to the next version.

Thanks for the contribution.

sargue commented 7 years ago

Hi. Sorry for the delay.

I've been reading about that header and I don't think that it deserves a first level method just for it. I understand you need to define it on every mail building.

That has given me the idea that a more general solution would be to allow for parameters and headers to be defined on the configuration object so they would be used for every mail sent without the need to repeat it every time.

I think that would solve your problem but also, potentially, give more flexibility for other use cases.

What do you think?

ofirmiron commented 7 years ago

I like this idea. I still think that sender deserves a Java method, but it is up to you. Your solution would also work.

sargue commented 7 years ago

I've just published a new version with the default parameters management in the configuration object. Please check it out and see if it fits your needs.

Salut!