eikek / emil Goto Github PK
View Code? Open in Web Editor NEWEmil is a library for dealing with E-Mail in Scala.
Home Page: https://eikek.github.io/emil/
License: MIT License
Emil is a library for dealing with E-Mail in Scala.
Home Page: https://eikek.github.io/emil/
License: MIT License
can this library also delete mails from inboxes?
If not, is it planed to support this via IMAP?
I'm trying to use the JavaMailEmil
class to write a program, but when I try to call emil.run
, I get a type mismatch. See the following code:
val emil = JavaMailEmil[Task](blocker)
val imapConf: MailConfig =
MailConfig(myEmail.server, myEmail.user, myEmail.password, SSLType.SSL)
val access: Access[Task, JavaMailConnection] = new AccessImpl[Task](blocker)
def searchInbox: MailOp[Task, JavaMailConnection, SearchResult[Mail[Task]]] =
for {
inbox <- access.getInbox
emails <- access.searchAndLoad(inbox, 1)(
(Subject contains "MySubject")
)
} yield emails
emil(imapConf).run(searchInbox /* Type mismatch here */ )
This is the type mismatch, where emil.run
is expecting an emil.C
connection instead of a JavaMailConnection
for MailOp
:
I looked into the JavaMailEmil
apply method and found that it is returning type Emil
rather than type JavaMailEmil
. I published a version of your lib locally where I changed the apply function to return type JavaMailEmil
and type mismatches go away, everything compiles and runs like a dream.
Emil
is the return type on purpose, can you tell me what I'm doing wrong so I can implement it correctly? I'm not sure why it would need to return an Emil
type when we already know it extends the Emil
traitThanks so much!
More and more dependencies are moving forward to require at least jdk11. I'd like to do the same for emil - are there any concerns? (@sideeffffect If I remember correctly, you needed java8 in the past - is this still the case?)
It seems like tests fail on Java 11.
Try adding [email protected]
to the .github/workflows/ci.yml
matrix. Possibly even [email protected]
to test on the newest version of Java.
[info] - insert complete mail *** FAILED ***
[info] ClassCastException: class com.sun.mail.handlers.text_plain cannot be cast to class javax.activation.DataContentHandler (com.sun.mail.handlers.text_plain is in unnamed module of loader sbt.internal.LayeredClassLoader @4d924b5f; javax.activation.DataContentHandler is in unnamed module of loader sbt.internal.LayeredClassLoader @795978fc)
[info] javax.activation.MailcapCommandMap.getDataContentHandler(MailcapCommandMap.java:601)
[info] javax.activation.MailcapCommandMap.createDataContentHandler(MailcapCommandMap.java:555)
[info] javax.activation.DataHandler.getDataContentHandler(DataHandler.java:600)
[info] javax.activation.DataHandler.writeTo(DataHandler.java:299)
[info] javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:316)
[info] javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1551)
[info] javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1148)
[info] javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:498)
[info] javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1509)
[info] javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1148)
[info] javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:498)
[info] javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1509)
[info] javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2247)
[info] javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2207)
[info] emil.javamail.conv.BasicEncode.assemble$1(BasicEncode.scala:148)
[info] emil.javamail.conv.BasicEncode.$anonfun$mailEncode$10(BasicEncode.scala:156)
[info] map @ emil.javamail.conv.BasicEncode.$anonfun$bodyEncode$4(BasicEncode.scala:83)
[info] flatMap @ emil.javamail.conv.BasicEncode.$anonfun$bodyEncode$1(BasicEncode.scala:82)
[info] map @ emil.javamail.conv.BasicEncode.$anonfun$mailEncode$9(BasicEncode.scala:154)
[info] map @ emil.javamail.conv.BasicEncode.$anonfun$mailEncode$9(BasicEncode.scala:154)
[info] map @ fs2.internal.CompileScope.$anonfun$close$9(CompileScope.scala:246)
[info] flatMap @ fs2.internal.CompileScope.$anonfun$close$6(CompileScope.scala:245)
[info] map @ fs2.internal.CompileScope.fs2$internal$CompileScope$$traverseError(CompileScope.scala:222)
[info] flatMap @ fs2.internal.CompileScope.$anonfun$close$4(CompileScope.scala:244)
[info] map @ fs2.internal.CompileScope.fs2$internal$CompileScope$$traverseError(CompileScope.scala:222)
[info] flatMap @ fs2.internal.CompileScope.$anonfun$close$2(CompileScope.scala:242)
[info] flatMap @ fs2.internal.CompileScope.close(CompileScope.scala:241)
[info] rethrow$extension @ fs2.Stream$Compiler$.$anonfun$compile$2(Stream.scala:4220)
[info] flatMap @ fs2.internal.CompileScope.$anonfun$openAncestor$2(CompileScope.scala:261)
[info] flatMap @ fs2.internal.FreeC$.$anonfun$compile$17(Algebra.scala:545)
[info] map @ fs2.internal.CompileScope.$anonfun$close$9(CompileScope.scala:246)
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)
Hello, could you please create a branch series/0.9.x
on the commit sideeffffect@d1c8960 (last before Cats Effect 3) like I have here https://github.com/sideeffffect/emil/tree/series/0.9.x ?
I will then backport #310 to 0.9.x so that we can have this feature while still being on Cats Effect 2.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.