playframework / play-mailer Goto Github PK
View Code? Open in Web Editor NEWPlay mailer plugin
License: Apache License 2.0
Play mailer plugin
License: Apache License 2.0
@jroper Since we are breaking the API, I think it would be great to release version 2.3.6 to mark that change and update the README accordingly.
I'm trying to generate an email with inline image. Based on my tests, it seems that there is no way to define cid (it's not included in generated mail) for an inline attachment.
Can you please verify?
Currently the documentation format is in Ascii Doc I don't think that is suitable anymore.
I would like to propose a switch to either Markdown or RST
Hello, currently we have something like that:
class SMTPMailer @Inject() (smtpConfiguration: SMTPConfiguration) extends MailerClient {
However the Provider doesn't help here since the SMTPMailer will just do the same as before.
Currently it would be great if SMTPMailer stays the same so that we contain compability, however for the injection point it would be better to have something like:
class ConfigurableMailer @Inject()(smtpConfigurationProvider: Provider[SMTPConfiguration]) extends MailerClient {
override def send(data: Email): String = {
new SMTPMailer(smtpConfigurationProvider.get()).send(data)
}
}
If we don't the Provider makes just no sense.
The sample application included fails to compile because it's looking for MailerPlugin
inside play.api.libs.mailer
. On inspection of the latest 2.3.1 release, it appears to still be located within the com.typesafe.plugin
namespace.
The namespace changes on github don't appear to be reflected in the published jar.
Hi,
Play 2.4 supports both runtime and compile time dependency injection.
As CommonsMailer uses @Inject
it seems impossible to use it without the Guice container.
It would be nice to provide a trait that provide a "raw" mailer client and that could be mixed in Play's BuiltInComponentsFromContext
to support compile time DI, like this WS Component for example.
Thanks
Loïc
Currently the package of the mailer is com.typesafe.plugins
. It should probably be play.libs.mailer
for Java and play.api.libs.mailer
for Scala.
Hi,
The Play Mailer project is using 2.4.2 right now which should not have any issues, but I just wanted to note that in the Play Framework Master branch things have changed that would cause PlayConfig to break if run against Play Master instead of 2.4.2.
This pull request: playframework/playframework#4588 has removed the getOptional calls that are used by MailerPlugin.scala (See: https://github.com/playframework/play-mailer/blob/35358de784cae2158d12579d0283b10a28dcb0a3/src/main/scala/play/api/libs/mailer/MailerPlugin.scala)
As such, at some point you will probably want to adjust the Play Mailer plugin accoringly.
Thanks,
-Sean
Hi,
Is it possible to configure the connect and I/O timeouts?
I (think) that I can see that they are not configurable as plugin settings, but I am not sure whether it is possible to configure the underlying javax.mail session directly.
Setting mail.smtp.timeout and mail.smtp.connectiontimeout as system properties has no effect since commons-email's org.apache.commons.mail.Email has a default timeout greater than zero (EmailConstants.SOCKET_TIMEOUT_MS) and that will be used instead (lines 678 -> 687).
If I am not mistaken and the plugin does not currently support configuring those options, do you think that support should be added?
Thanks,
-Dan
I am using play-mailer 3.0.0-RC1 with play 2.4.0 java.
When I start my app I have a warning that tolds me to use the new syntax for configuration
But with this new syntax I have an exception java.lang.RuntimeException: play.mailer.host needs to be set in application.conf in order to use this plugin (or set play.mailer.mock to true)
Configuration that works
smtp {
host = "mailtrap.io"
port = 2525
tls = true
user = "xxx"
password = "xxx"
}
Configuration that does not work
play {
mailer {
host = "mailtrap.io"
port = 2525
tls = true
user = "xxx"
password = "xxx"
}
}
There is an issue with using "com.typesafe.play.plugins" %% "play-plugins-mailer" % "2.3.1"
as described here [https://github.com/playframework/play-mailer/blob/master/README.md].
Take a look at contents of [http://repo.typesafe.com/typesafe/releases/com/typesafe/play/plugins/play-plugins-mailer_2.11/2.3.1/play-plugins-mailer_2.11-2.3.1.jar]
[09:05:29] skierat ~/Downloads jar tvf play-plugins-mailer_2.11-2.3.1.jar
323 Fri Oct 24 08:39:06 CEST 2014 META-INF/MANIFEST.MF
0 Fri Oct 24 08:39:06 CEST 2014 com/
0 Fri Oct 24 08:39:06 CEST 2014 com/typesafe/
0 Fri Oct 24 08:39:06 CEST 2014 com/typesafe/plugin/
507 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerPlugin.class
3228 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder$Attachment$.class
1092 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$19.class
2163 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$8$$anonfun$apply$6.class
1668 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$9.class
6268 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder.class
5403 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer.class
1581 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$4.class
1186 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerAPI.class
1009 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailerPlugin$$anonfun$3.class
1316 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$12.class
1318 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$17.class
1319 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$13.class
1522 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$18.class
927 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$1.class
1054 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$8$$anonfun$7.class
1238 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$14$$anonfun$apply$13.class
1618 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$9$$anonfun$apply$9.class
1319 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$11.class
4893 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailerPlugin.class
1581 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$6.class
846 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$10.class
5187 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder$Attachment.class
1314 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$14.class
1514 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$7.class
1269 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder$$anon$3.class
2279 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$8$$anonfun$apply$6$$anonfun$apply$7.class
1025 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anon$1$$anonfun$write$1.class
1136 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailerPlugin$$anonfun$8.class
1703 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder$$anonfun$e$2.class
13241 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer.class
1315 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$16.class
1240 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$16$$anonfun$apply$15.class
2220 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$8$$anonfun$apply$8.class
922 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$5.class
1581 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$3.class
1562 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$5$$anonfun$apply$4.class
1136 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder$$anonfun$e$3.class
1248 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$13$$anonfun$apply$12.class
1246 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$17$$anonfun$apply$16.class
1563 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$6$$anonfun$apply$5.class
1124 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anon$1$$anonfun$write$2.class
1581 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$2.class
1305 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$8$$anonfun$6.class
9495 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder$class.class
1297 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailerPlugin$$anonfun$enabled$1.class
1567 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$3$$anonfun$apply$2.class
1448 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$18$$anonfun$apply$17.class
1263 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder$$anon$2.class
944 Fri Oct 24 08:39:06 CEST 2014 com/typesafe/plugin/MailerApiJavaInterop.class
1612 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MailerBuilder$$anonfun$e$1.class
10429 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$.class
1317 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anon$1.class
1242 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$12$$anonfun$apply$11.class
2588 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$8.class
1009 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailerPlugin$$anonfun$2.class
1314 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$15.class
1564 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$2$$anonfun$apply$1.class
1248 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$11$$anonfun$apply$10.class
1009 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailerPlugin$$anonfun$4.class
1562 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$4$$anonfun$apply$3.class
1581 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailer$$anonfun$send$5.class
973 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailerPlugin$$anonfun$mock$1.class
1092 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$20.class
1010 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/CommonsMailerPlugin$$anonfun$1.class
1238 Fri Oct 24 08:39:04 CEST 2014 com/typesafe/plugin/MockMailer$$anonfun$send$15$$anonfun$apply$14.class
There isn't a package play.api.libs
I found a related problem on [http://stackoverflow.com/questions/27130048/how-to-use-play-plugins-mailer-with-play-2-3-and-scala-2-11]
I don't want to build from sources, so could you please fix and release a correct version?
It seems that sbt can't resolve the javax.activation
transitive dependency.
Using Play! 2.4.x.
In build.sbt
:
libraryDependencies ++= Seq(
// other things...
"com.typesafe.play" %% "play-mailer" % "3.0.1"
)
When attempting to compile with sbt there is a dependency resolution error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: javax.activation#activation;1.1.1: configuration not found in javax.activation#activation;1.1.1: 'master(compile)'. Missing configuration: 'compile'. It was required from org.apache.commons#commons-email;1.3.3 compile
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] javax.activation:activation:1.1.1
[warn] +- org.apache.commons:commons-email:1.3.3
[warn] +- com.typesafe.play:play-mailer_2.11:2.4.1 (/Users/pete/projects/issuance/build.sbt#L14-31)
[warn] +- issuance:issuance_2.11:1.0-SNAPSHOT
...
sbt.ResolveException: unresolved dependency: javax.activation#activation;1.1.1: configuration not found in javax.activation#activation;1.1.1: 'master(compile)'. Missing configuration: 'compile'. It was required from org.apache.commons#commons-email;1.3.3 compile
Hello,
I'm trying to use the newest version 4.0.0-SNAPSHOT but it is not in the Maven repo.
It says
com.typesafe.play#play-mailer_2.11;4.0.0-SNAPSHOT: not found
Hello im working on a play project
and im trying to get this plugin working.
But im getting this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/mail/MultiPartEmail
at play.api.libs.mailer.CommonsMailerPlugin.mailerInstance$lzycompute(MailerPlugin.scala:531)
https://gist.github.com/hendrik-weiler/8def78a77f2802a69c18
Ive build the plugin from source and add it to the lib folder.
Im running the dist application using this script:
https://github.com/rpgboss/rpgboss-asset-server/blob/master/run-asset-server.sh
The project im working on:
https://github.com/rpgboss/rpgboss-asset-server
Trying to friend play-2.4
with play-mailer
plugin, but:
[error] application -
! @6keh7m8ll - Internal server error, for (GET) [/] ->
play.api.UnexpectedException: Unexpected exception[ConfigurationException: Guice configuration errors:
1) Could not find a suitable constructor in com.typesafe.plugin.CommonsMailerPlugin. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at com.typesafe.plugin.CommonsMailerPlugin.class(MailerPlugin.scala:490)
while locating com.typesafe.plugin.CommonsMailerPlugin
1 error]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:176) ~[play_2.11-2.4.0-M2.jar:2.4.0-M2]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:130) ~[play_2.11-2.4.0-M2.jar:2.4.0-M2]
at scala.Option.map(Option.scala:145) ~[scala-library-2.11.4.jar:na]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:130) ~[play_2.11-2.4.0-M2.jar:2.4.0-M2]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:128) ~[play_2.11-2.4.0-M2.jar:2.4.0-M2]
Caused by: com.google.inject.ConfigurationException: Guice configuration errors:
1) Could not find a suitable constructor in com.typesafe.plugin.CommonsMailerPlugin. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at com.typesafe.plugin.CommonsMailerPlugin.class(MailerPlugin.scala:490)
while locating com.typesafe.plugin.CommonsMailerPlugin
1 error
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1004) ~[guice-3.0.jar:na]
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:961) ~[guice-3.0.jar:na]
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013) ~[guice-3.0.jar:na]
at play.api.inject.guice.GuiceInjector.instanceOf(GuiceApplicationLoader.scala:140) ~[play_2.11-2.4.0-M2.jar:2.4.0-M2]
at play.api.Plugins$$anonfun$loadPlugins$1.apply(Plugins.scala:89) ~[play_2.11-2.4.0-M2.jar:2.4.0-M2]
I think we should publish a version 4.0.0 "final" version for Play! 2.4 (with commons-email 1.4) from this commit: 4371da0
There are a lot of email service providers with Web API:
It could be nice to provide an abstraction/extension point to allow users to switch from one provider to another (with SMTP as the default provider). What do you think ?
1.- package play.libs.mailer does not exist
2.- package play.libs.mailer.MailerPlugin does not exist
your whole plugin doesn't work :S is there any alternative?
Hi All,
The "configure" method is a real plus.
Please do you know when the change will be released ?
Regards,
PYC
Is there a way to test that an email is sent, and check the contents of it? Would be nice to do something like:
"A verification email is sent when the user has registered" in {
MailPlugin.startCapturing()
UserModule.registerNewUser(name = "Frodo", email = "[email protected]")
val emails: List[Email] = MailPlugin.stopCapturingAndCollectResults()
emails mustEqual List(
Email(
subject = "Welcome Frodo",
recipient = "[email protected]",
bodyText = "Here is your verifcation link: ______"
)
)
}
Or perhaps something more "functional"/safe:
"A verification email is sent when the user has registered" in {
val emails: List[Email] = MailPlugin.captureMailsSentInBlock {
UserModule.registerNewUser(name = "Frodo", email = "[email protected]")
}
emails mustEqual List(
Email(
subject = "Welcome Frodo",
recipient = "[email protected]",
bodyText = "Here is your verifcation link: ______"
)
)
}
Is it possible to do something like this at all right now? ie. Setting the plugin in testing/capture mode so that we can verify: (1) that en email is sent, (2) verify the contents of it.
Also, mock-mode must be on when running your test suite, right? (play.mailer.mock = yes
)
I'm sorry if this is asked before, but I couldn't find anything in the manual or from searching.
I hav set in my application configuration the param smpt.mock=true and I get the following error by executing the testcae. What should be wrong?
java.lang.RuntimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)
smtp.mock=true
#smtp.host=smtp.gmail.com
#smtp.port=587
#smtp.ssl=true
#smtp.user="xxx"
#smtp.password=xxx
@Test
public void testIndexWithTestServerRunnable() {
running(testServer(3333), new Runnable() {
@Override
public void run() {
assertThat(
WS.url("http://localhost:3333").get().get(5000).getStatus()
).isEqualTo(OK);
}
});
}
Hi. Can you make 2.4.1 or 2.4.1-SNAPSHOT release. I need issues from this commit : 3ae39a8
to be fixed pretty bad.
Thanks
Looks like the Readme.md is misleading. The information doesnot help while testing for Play 2.3.6.
This version will be compatible with Play! 2.5 and will make it easier to use dynamic configuration with runtime DI: #81
This version must be released from master
branch.
Previously the play-mailer depended on play plugins util for users to conveniently access it. Let's remove this dependency.
Instead create an object that takes an implicit application to get the mailer in Scala, and a plain old static method in Java.
For Play 2.4, we should switch to using the new modules API and expect people to use DI.
Currently the MailerPlugin and the MailerPluginSpec used a single file for their plugin, however that isn't suitable anymore since the project grown and now contains a lot of classes / lines of code in a single file.
To cleanup this plugin we should split the most classes into a single file / group them when they should stick together.
We've migrated all of the Play config to provide all defaults in reference.conf
, even optional values, these get a default of null
, and documenting everything in there. play-mailer should do this too. Additionally, we've namespaced everything in play
. I think the mailer should use the namespace of play.mailer
.
Whoever implements this, take a look at play.api.PlayConfig
, this can be used to "deprecate" the old config, so we can say:
val mailerConfig = PlayConfig(configuration).getDeprecated[PlayConfig]("play.mailer", "smtp")
That way, the user gets a deprecation warning if they have anything configured at smtp
.
Hello, currently it would be great if we would have more options in specifing Mime Data.
I think the only way to handle that as good as possible would be a more loose mime field which would just append the necessary Bytes.
Like a List[(String, String)] or something which will be appended without validation
I would like to instantiate an instance of a MailerClient outside of a Play controller or component (i.e. without dependency injection) for usage in a Util object, like:
object Util {
val mailerClient = xxxxx
def sendMail(email: Email) {
mailer.send(email)
}
Do I have to use native Guice or how does this work?
Thanks,
Peter
I checked the contribution guidelines, and I still didnt know whether I should post this on the mailing list or here. But the 3.0.0-M1 is broken and not compatible with play2.4, as (I checked in the code) it does not have the MailPlugin object. Are you able to release a M2 as soon as you get the chance?
I've documented what I'm seeing here: http://stackoverflow.com/questions/31343401/scala-play-2-4-x-how-to-call-a-class-with-inject-annotation
Was following the Java example on home page, use Field injection in Play 2.4. But in debug it seems always have null for MailerClient
.
code looks like this:
class EnvelopJob implements Runnable {
Mail.Envelop envelop;
@Inject MailerClient mailerClient;
public EnvelopJob(Mail.Envelop envelop) {
this.envelop = envelop;
}
public void run() {
Email email = new Email();
final Configuration root = Configuration.root();
final String mailFrom = root.getString("mail.from");
email.setFrom(mailFrom);
email.setSubject(envelop.subject);
for (String toEmail : envelop.toEmails) {
email.addTo(toEmail);
Logger.debug("Mail.sendMail: Mail will be sent to " + toEmail);
}
final String mailSign = root.getString("mail.sign");
email.setBodyText(envelop.message + "\n\n " + mailSign);
mailerClient.send(email);
}
}
Here is a Gist with a first design of the new API for Scala: https://gist.github.com/Mogztter/2dd50318baf53c64231b
We can also provide a "Java" like builder API using var
: https://gist.github.com/kencoba/1874015. That way we can have a similar API between Scala and Java and also be "retrocompatible" but I dont know if it's a good idea... this pattern is a bit awkward in Scala.
Hello, currently the configuration of the Mailer is only changeable inside the application.conf,
however that is aweful since sometimes you wan't to make it User Configurable.
Hello, currently it would be great if we could change the Logger in MockMailer. Currently MockMailer could be used for testing, however thats impossible if the Mailer uses a static Logger instance.
It would help to make things like this work: http://stackoverflow.com/questions/17719552/unit-test-logger-messages-using-specs2-scalalogging
However at the moment there is no possible way to inject the Logger from Play!
Mistake in a name of the sender when using cyrillics
Email email = new Email();
email.setFrom("Тест <[email protected]>");
Output:
From: ""5AB" <[email protected]>
Should be so:
From: =?UTF-8?B?0KLQtdGB0YI=?= <[email protected]>
Return-Path: is used to handle bounce email.I have tried with bounceAddress variable avaiable in Email class but it's not working
When trying to compile master
I get :
sbt.ResolveException: unresolved dependency: org.json4s#json4s-native_2.10;3.2.10: configuration not found in org.json4s#json4s-native_2.10;3.2.10: 'master(compile)'. Missing configuration: 'compile'. It was required from net.databinder.dispatch#dispatch-json4s-native_2.10;0.11.2 compile
The 2.3.x
branch builds find. From what I can tell the only diff between the branches that would cause issues with building is the switch to v8 of the JDK. Which is strange since I'm running Java 8:
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
$ javac -version
javac 1.8.0_45
Any ideas? I'm probably missing something simple!
Thanks
Use the new Play 2.4 dependency injection with modules instead of plugins.
https://playframework.com/documentation/2.4.0-M2/ScalaDependencyInjection#Play-libraries
When I send an email I don't want to "block" my process. I'm using Akka to "schedule" the send:
Akka.system.scheduler.scheduleOnce(1.seconds) {
}
Maybe we can add a sendAsync
to the API to do that ? or just an example in the documentation ?
And it might be better to return a Future
?
package mail
import javax.inject.Provider
import play.api.libs.SMTPConfiguration
import play.api.{Configuration, Environment}
import play.api.inject.Module
class TestMailerConfigurationProvider extends Provider[SMTPConfiguration] {
override def get() = new SMTPConfiguration("http://192.168.9.2", 25)
}
class TestMailerConfigurationModule extends Module {
def bindings(environment: Environment, configuration: Configuration) = Seq(
bind[SMTPConfiguration].toProvider[TestConfigurationProvider]
)
}
Hi, I'm pretty new to Scala here so pardon me in advance. Above is my implementation of runtime mailer provider override as seen in the samples of this repo. However, this causes a CompilationError due to [object SMTPConfiguration is not a member of package play.api.libs.mailer]
My current version of mailer included in built.sbt is
"com.typesafe.play" %% "play-mailer" % "3.0.1"
Is this class not included in the package as of that version?
Thank you for your help in advance.
Currently it's always hard to force a certain style to your editor, for that there is a great plugin called editorconfig. Could I support a PR to support that?
In my Global.java I'm trying to schedule a task which has to sent an email every now and then based on some parameters. I can't seem to access mailerClient though, because I always get a NullPointerException. Can someone explain what I'm doing wrong? My code looks roughly like this:
public class Global extends GlobalSettings {
@Inject MailerClient mailerClient;
public void onStart(Application app) {
// lines of code
Runnable showTime = new Runnable() {
@Override
public void run() {
//lines of code
mailerClient.send(email);
}
}
}
}
I can't seem to figure out what's going wrong, any help is appreciated.
A question: is it possible in a bulk email situation to add the target email to the html?
Google's guidelines suggest that there should be an unsubscribe link which only needs one click for the user to unsubscribe. This means that each email is unique. Currently I add all my recipients to a single message, but I don't see a way of doing this.
I haven't tested the impact of creating 5000+ separate emails, and that might be an option, but I would first like to check if there is a more efficient way.
Currently Compile Time Dependency Injection has no Documentation.
The snippet of #81 (comment) should be added.
I've tried
sbt.ResolveException: unresolved dependency: com.typesafe.play#play-mailer;2.4.0-RC1: not found
sbt.ResolveException: unresolved dependency: com.typesafe.play#play-mailer;2.4.0: not found
sbt.ResolveException: unresolved dependency: com.typesafe.play#play-mailer;2.4.1: not found
sbt.ResolveException: unresolved dependency: com.typesafe.play#play-mailer;2.4.1-SNAPSHOT: not found
sbt.ResolveException: unresolved dependency: com.typesafe.play#play-mailer;3.0.0-M1: not found
sbt.ResolveException: unresolved dependency: com.typesafe.play#play-mailer;{version}: not found
(just in case this was supposed to be an automatic thingy...)
There must be some "obvious" way to determine exactly what the current version is to the initiated.
Please initiate me :)
I fell in love with Play -- turns out that I'm really starting to hate sbt :(
I think we need to release a new milestone (M2) for Play 2.4.0 for Scala 2.10 and Scala 2.11. Maybe after #44 to avoid breaking changes.
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.