sargue / mailgun

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

How to Multiple attachment? #23

Closed Gauthamrathinakumar closed 6 years ago

Gauthamrathinakumar commented 6 years ago

Hi Sargue, I am able to send mail with a single attachment . But I don't know to add the multiple attachments.Please help with this. Thanks in advance.

sargue commented 6 years ago

Just repeat the attachment() call.

Taking the front page example that would be:

Mail.using(configuration)
    .to("marty@mcfly.com")
    .subject("This message has an text attachment")
    .text("Please find attached a file.")
    .multipart()
    .attachment(new File("/path/to/image.jpg"))
    .attachment(new File("/path/to/report.pdf"))
    .build()
    .send();