GithubHelp home page GithubHelp logo

eikek / emil Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 15.0 2.06 MB

Emil is a library for dealing with E-Mail in Scala.

Home Page: https://eikek.github.io/emil/

License: MIT License

Scala 99.63% Nix 0.14% CSS 0.02% JavaScript 0.21%
email scala-library

emil's People

Contributors

edwardcwang avatar eichholz avatar eikek avatar eikek-scala-steward[bot] avatar havelkahonza avatar jsoref avatar mergify[bot] avatar moerfi666 avatar renovate-bot avatar renovate[bot] avatar rustamsultanov avatar scala-steward avatar sideeffffect avatar ybasket avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

emil's Issues

deleting mails

can this library also delete mails from inboxes?
If not, is it planed to support this via IMAP?

Type mismatch when using JavaMailEmil

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:
Screen Shot 2021-06-17 at 10 34 48 AM

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.

  • If 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 trait
  • Otherwise, I can make a pull request fixing the apply method return type.

Thanks so much!

Stop supporting jdk8

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?)

Tests fail on Java 11

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)

Action Required: Fix Renovate Configuration

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)

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.