dmurvihill / courier Goto Github PK
View Code? Open in Web Editor NEWsend electronic mail with scala
License: MIT License
send electronic mail with scala
License: MIT License
Unsurprisingly, adding this line makes it work:
https://github.com/softprops/courier/blob/master/src/main/scala/mailer.scala#L22
setReplyTo(e._replyTo.toArray)
Are there plans to upgrade to 2.13?
I have a problem with encoding. Am I doing something wrong or there is a problem with Coureir? How can I fix this?
I am sending:
<html>
<head>
<meta charset="UTF-8" />
</head>
<body>
<h1>Diacritics: żółć</h1>
</body>
</html>
and getting:
<h1>Diacritics: ?�??</h1>
the email looks like this:
------=_Part_0_1597551722.1405604258142
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta charset=3D"text/html; charset=3DUTF-8"/>
</head>
<body>
<h1>Diacritics: ?=F3??</h1>
</body>
</html>
------=_Part_0_1597551722.1405604258142--
On Windows Machines I get the following error, when I try to send multipart messages.
This is a bug with 1.0.0 and 2.0.0 too.
javax.mail.MessagingException: IOException while sending message
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365)
at javax.mail.Transport.send0(Transport.java:255)
at javax.mail.Transport.send(Transport.java:124)
at courier.Mailer.$anonfun$apply$1(mailer.scala:37)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:654)
at scala.util.Success.$anonfun$map$1(Try.scala:251)
at scala.util.Success.map(Try.scala:209)
at scala.concurrent.Future.$anonfun$map$1(Future.scala:288)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_0_1807859575.1582802492185"
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:896)
at javax.activation.DataHandler.writeTo(DataHandler.java:317)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315)
... 16 common frames omitted
Any chance you can push 0.1.1 for 2.10 on bintray? It's only currently available to 2.9.3.
Cheers,
Rowland
Hi,
I've tried to set debug as true but it doesn't print anything. Am I missing something ?
Currently, debug setting as "true" init a property mail.smtp.debug but isn't it better to just call setDebug(true) on the javax MailSession ?
Best regards
would like to retry if a send fails. this should use retry to retry futures
I cannot explicitly pass a charset to encode mail text. Is this feature missing?
Hi, I think this project needs a little maintenance and I would like to know if I can submit PR here and they will be considered or if I should go ahead and fork the repository.
Future
and allow for other type constructor to be used for asynchronous computationI have already started the work on my fork https://github.com/daddykotex/courier
Thanks, David
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: ch.lightshed#courier_2.12;0.1.4: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] ch.lightshed:courier_2.12:0.1.4
...
[trace] Stack trace suppressed: run last :update for the full output.
[error] (:update) sbt.ResolveException: unresolved dependency: ch.lightshed#cou
rier_2.12;0.1.4: not found
build.sbt:
resolvers += "lightshed-maven" at "http://dl.bintray.com/content/lightshed/maven"
libraryDependencies += "ch.lightshed" %% "courier" % "0.1.4"
I'm updating my project to Scala 2.11.1 and there seems to be no Courier artifact.
It would be great, if one could provider their own root certificate authority so that self-signed certificates can be validated during the startTLS / TLS session.
need help ....i have no idea how to change font to courier for my emails. I use g suites on andiod google pixel xl phone. If someone could explain to me as if i were a five year old I would be most appreciative.
thank you
shane
Hi @softprops ,
I have been using this library quite successfully for some time now and I was wondering if it's possible to embed image within the body itself rather than as an attachment?
Please help me out a bit here :)
It took me a while to figure out why Courier couldn't connect to the outgoing e-mail server I use, on port 465. A usage example which specifically calls the sslSocketFactory definition on the session builder would have saved me a bunch of time.
Thank you for providing Courier to us.
The following code
val mailer = Mailer("example.com", 587)
.auth(true)
.as("[email protected]", "pwd")
.ssl(true)()
gives me value ssl is not a member of courier.Session.Builder
There seems to be no way currently of doing ScalaTest/Specs2 testing with courier, meaning some way to make it so the message isn't actually sent but stored somewhere where you can assert that an email with certain characteristics would have been sent.
Update sbt bintray plugin to version 0.3.0
The examples on the wiki don't compile.
Specifically:
mailer(Envelope.from("you" `@` "gmail.com")
.to("mom" `@` "gmail.com")
.cc("dad" `@` "gmail.com")
.subject("miss you")
.content(Text("hi mom"))).onSuccess {
case _ => println("message delivered")
}
Gives this result:
[error] /Users/zbeckman/Projects/Glimpulse/Server/project/glimpulse-server/test/utility/TestMail.scala:26: too many arguments for method apply: ()courier.Mailer in class Builder
[error] mailer(Envelope.from("you" `@` "gmail.com")
[error] ^
Hi,
did anyone try testing using Mock JavaMail these days? I'm getting an exception on the line val mailer = Mailer("localhost", 25)()
Future(Failure(com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1; nested exception is:java.net.ConnectException: Connection refused (Connection refused)))
Then momsInbox
is empty.
To have programs like Outlook display the HTML part of multipart (HTML & simple text) messages correctly, I have to use the MimeMultipart "multipart/related". I can't find an easy way to do this with courier. I think it could easily be added to the library as follows:
subtype: String = "mixed"
new MimeMultipart(subtype)
With this, I think that my issue could be solved, so I can send an email like this:
Envelope
.from(new InternetAddress(from))
.to(new InternetAddress(to))
.subject(subject)
.content(Multipart(subtype = "related").text(textContent).html(htmlContent))
If you want I can provide a pull request.
When trying to send email in both text and html format the Content-type of the email is set as multipart/mixed instead of multipart/alternative. Because of this gmail shows both the text and the html parts instead of showing only the most preferred one (the html version).
The ls project has been discontinued, therefore it makes sense to remove support from courier.
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.