sargue / mailgun

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

Add support for Mailgun's MIME API call #22

Closed rafaelgsra closed 2 years ago

rafaelgsra commented 6 years ago

Mailgun supports sending MIME messages calling /messages.mime instead of /messages. To build a Mail object, it should be just a matter of passing the MIME-formatted message to MailBuilder.text(), or if there is some handling that would break the format, then adding a new MailBuilder.mime(). Also in this case no subject is needed.

What do you think, worth considering?

Thanks for the good library!

sargue commented 6 years ago

Hello! Thanks for waiting, I was on holidays.

Yes, seems worth considering of course. I have no experience with the MIME messages options of Mailgun so it may need some time. PRs are welcome, of course.

rafaelgsra commented 6 years ago

Hi!

Eventually we decided to just call directly Mailgun API using UniRest. Once the message is MIME formatted, it is just a matter of calling POST /messages.mime as multipart/form-data setting the parameters "to" (with the receivers' email addresses) and "message" (with the MIME-formatted email).

Thanks anyways!

sargue commented 6 years ago

Oh ok, thanks for reporting.

I will keep the issue open just to evaluate its implementation as it may prove useful for anybody else.

kopax commented 4 years ago

Hi, does that mean that we can't send attachement with that lib (such as PDF files)?

@rafaelgsra it would be nice if you can share your solution.

Thanks!

sargue commented 4 years ago

No, you CAN send attachments with the current library.

There is an example of sending an email with an attachment on the front page of the project. Second example.