GithubHelp home page GithubHelp logo

Streaming attachments about play-mailer HOT 3 CLOSED

tg44 avatar tg44 commented on June 9, 2024
Streaming attachments

from play-mailer.

Comments (3)

mkurz avatar mkurz commented on June 9, 2024

With play-mailers own Email class, currently this is not possible (yet). Right now we support only files or arrays as attachment.
However, play-mailer uses Apache Commons Email under the hood, which provides some additional methods to attach(...) attachments, like passing a javax.activation.DataSource...
You are welcome to provide a pull request... You would need to add another method to handle a Source[ByteString, NotUsed] and convert it to a DataSource, similarly to these methods.

Actually looking at the code it looks like there is a workaound for now... The MailerClient you inject is an object of CommonsMailer, therefore you could use the the ยดcreateEmail(...) method which gives you a Apache Commons MultiPartEmail which you can then send, like

val multipartEmail = commonsMailerClient.createEmail(myExistingEmail);
multipartEmail.attach(myDataSource, ...); // multipartEmail is Apaches own email implementation
....
commonsMailerClient.send(multipartEmail);

from play-mailer.

tg44 avatar tg44 commented on June 9, 2024

The project currently not use any akka deps, this was the main reason I didn't hop to a "lets make a PR" train.

What do you think, should we document this workaround, or create a module/artifact just for the additional streaming? Adding akka as a dep could be a pain, I would not cross that bridge if I don't need to...

from play-mailer.

mkurz avatar mkurz commented on June 9, 2024

Finally found time for a PR: #193

from play-mailer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.