[2.0] typesafe mailer plugin fail

2,251 views
Skip to first unread message

Joe Wyrembelski

unread,
Apr 22, 2012, 1:40:02 AM4/22/12
to play-fr...@googlegroups.com
I have followed the instructions https://github.com/typesafehub/play-plugins/tree/master/mailer twice within my project and also within a brand new sample project to no avail.  Has anyone been able to get this to work?

I follow the instructions in a fresh proejct (play new mailer-test) and get the following.  It seems to me that either the import statement is incorrect or the plugin is configured incorrectly - but haven't a clue where to look next.

/somedir/dev/mailer-test$ play update
[info] Loading project definition from /somedir/dev/mailer-test/project
[info] Set current project to mailer-test (in build file:/somedir/dev/mailer-test/)
[info] Updating {file:/somedir/dev/mailer-test/}mailer-test...
[info] Done updating.                                                               
[success] Total time: 3 s, completed Apr 22, 2012 1:31:07 AM

/somedir/dev/mailer-test$ play compile
[info] Loading project definition from /somedir/dev/mailer-test/project
[info] Set current project to mailer-test (in build file:/somedir/dev/mailer-test/)
[info] Compiling 4 Scala sources and 2 Java sources to /somedir/dev/mailer-test/target/scala-2.9.1/classes...
[error] Application.java:13: cannot find symbol
[error] symbol  : class MailerPlugin
[error] location: class controllers.Application
[error]     MailerPlugin mail = play.Play.application().plugin(MailerPlugin.class);
[error]     ^
[error] Application.java:13: cannot find symbol
[error] symbol  : class MailerPlugin
[error] location: class controllers.Application
[error]     MailerPlugin mail = play.Play.application().plugin(MailerPlugin.class);
[error]                                                        ^
[error] 2 errors
[error] {file:/somedir/dev/mailer-test/}mailer-test/compile:compile: javac returned nonzero exit code
[error] Total time: 11 s, completed Apr 22, 2012 1:31:22 AM

Joe Wyrembelski

unread,
Apr 22, 2012, 1:37:50 PM4/22/12
to play-fr...@googlegroups.com
Not sure if this is progress, but it smells like it.

In looking at the plugin jar that was pulled down to my machine, I see that the documentation at https://github.com/typesafehub/play-plugins/tree/master/mailer seems to be wrong.  Instead of adding "com.typesafe.plugin.CommonsMailerPlugin" to my previously non-existent conf/play.plugins file, the package should be "com.typesafe.plugin.notifiers.X".  For "X" I've used both the CommonsMailerPlugin and the MailerPlugin but neither have worked. As I'm using the default/sample Java app I'm just stuffing the example send mail code into the autogenerated application controller:

package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

import com.typesafe.plugin.*;
import com.typesafe.plugin.notifiers.*;

public class Application extends Controller {
 
  public static Result index() {
    MailerPlugin mail = play.Play.application().plugin(MailerPlugin.class);
    mail.setSubject("simplest mailer test");
    mail.addRecipient("some display name <some...@email.com>");
    mail.addFrom("some dispaly name <somef...@email.com>");
    mail.send("A text only message", "<html><body><p>An <b>html</b> message</p></body></html>" );

    return ok(index.render("Your new application is ready."));
  }
 
}

The errors I'm getting now are

[error] Application.java:15: cannot find symbol
[error] symbol  : method setSubject(java.lang.String)
[error] location: interface com.typesafe.plugin.notifiers.MailerPlugin
[error]     mail.setSubject("mailer");
[error]         ^
[error] Application.java:16: cannot find symbol
[error] symbol  : method addRecipient(java.lang.String,java.lang.String)
[error] location: interface com.typesafe.plugin.notifiers.MailerPlugin
[error]     mail.addRecipient("Peter Hausel Junior <nor...@email.com>","exa...@foo.com");
[error]         ^
[error] Application.java:17: cannot find symbol
[error] symbol  : method addFrom(java.lang.String)
[error] location: interface com.typesafe.plugin.notifiers.MailerPlugin
[error]     mail.addFrom("Peter Hausel <nor...@email.com>");
[error]         ^
[error] Application.java:18: cannot find symbol
[error] symbol  : method send(java.lang.String,java.lang.String)
[error] location: interface com.typesafe.plugin.notifiers.MailerPlugin
[error]     mail.send("sometext", "<html>somehtml</html>" );
[error]         ^
[error] 4 errors

Which don't seem to make much sense because the source (visible at https://github.com/typesafehub/play-plugins/blob/master/mailer/src/main/scala/com/typesafe/plugin/MailerPlugin.scala) looks like this should work great.

What am I missing?

Mikael Selander

unread,
Apr 27, 2012, 12:58:50 AM4/27/12
to play-fr...@googlegroups.com
I'm having the same issue. Would be nice to see someone from the team comment on this; and/or update the documentation :)

peter hausel

unread,
Apr 27, 2012, 8:38:26 AM4/27/12
to play-fr...@googlegroups.com
the plugin definitely needs to be referenced as com.typesafe.plugin.CommonsMailerPlugin
 
I will try it out from a simple java project and see what might be wrong.
[error]     mail.addRecipient("Peter Hausel Junior <nor...@email.com>","example@foo.com");

peter hausel

unread,
Apr 27, 2012, 8:43:49 AM4/27/12
to play-fr...@googlegroups.com
I removed the package notifier from the source (it was a bad copy and paste) and republished, please delete the previous version from your ivy repo. 

peter hausel

unread,
Apr 27, 2012, 12:17:31 PM4/27/12
to play-fr...@googlegroups.com
Ok found the java interop issue, will publish a new version asap

peter hausel

unread,
Apr 27, 2012, 3:53:01 PM4/27/12
to play-fr...@googlegroups.com
OK, it compiles now from java. here is a sample (the mail server still needs to be configured)

Thomas Felix

unread,
Apr 30, 2012, 11:56:40 AM4/30/12
to play-fr...@googlegroups.com
Hi Peter,

thanks for your work! But unfortunately when I follow your instructions from the given link, when I start the play server I get an exception, it is solved by using

1500:com.typesafe.plugin.CommonsMailerPlugin

as it is used in the example project (actually I have no clue what 1500: means), so maybe the README.md should be updated to avoid confusion. Many thanks anyways!

best regards,
Thomas

peter hausel

unread,
Apr 30, 2012, 12:24:43 PM4/30/12
to play-fr...@googlegroups.com
Hi Thomas, thanks for the heads-up - fixed the readme (1500 is determining the order in which the given plugin should be executed)

Joe Wyrembelski

unread,
May 2, 2012, 12:38:31 AM5/2/12
to play-fr...@googlegroups.com
Just executed a fresh test from dead scratch.  Luckily, testing your work doesn't take much time. As you can see in this screenshot, it didn't work.

http://screencast.com/t/fftz5DAd

Perhaps your documentation needs to be updated?
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/IwbW_DkLZr8J.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

peter hausel

unread,
May 2, 2012, 7:59:10 AM5/2/12
to play-fr...@googlegroups.com
Hi,

Are you sure you have the latest version of the plugin ?

-----------------------------------------------
phausel@box ~/workspace/play-plugins/mailer/sample 
$ sbt clean compile
[info] Loading project definition from /Users/phausel/workspace/play-plugins/mailer/sample/project
[info] Set current project to j (in build file:/Users/phausel/workspace/play-plugins/mailer/sample/)
[success] Total time: 0 s, completed May 2, 2012 7:57:02 AM
[info] Updating {file:/Users/phausel/workspace/play-plugins/mailer/sample/}j...
[info] [SUCCESSFUL ] com.typesafe#play-plugins-mailer_2.9.1;2.0!play-plugins-mailer_2.9.1.jar (405ms)
[info] Done updating.
[info] Compiling 4 Scala sources and 2 Java sources to /Users/phausel/workspace/play-plugins/mailer/sample/target/scala-2.9.1/classes...
[success] Total time: 16 s, completed May 2, 2012 7:57:18 AM

phausel@balaton-3 ~/workspace/play-plugins/mailer/sample 
$ cat app/controllers/Application.java 
package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

import com.typesafe.plugin.*;

public class Application extends Controller {
  
  public static Result index() {
    MailerAPI mail = play.Play.application().plugin(MailerPlugin.class).email();
    mail.setSubject("simplest mailer test");
    mail.addRecipient("some display name <some...@email.com>");
    mail.addFrom("some dispaly name <somef...@email.com>");
    mail.send("A text only message", "<html><body><p>An <b>html</b> message</p></body></html>" );

    return ok(index.render("Your new application is ready."));
  }
  
}


------------------

as I mentioned in this thread before, you might need to delete the previous version from your local ivy cache

HTH,
Peter
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.

tonyb

unread,
May 3, 2012, 11:20:49 AM5/3/12
to play-fr...@googlegroups.com
Works great for me
how can I send a template instead of an inline text?

thx for your help

peter hausel

unread,
May 3, 2012, 12:21:02 PM5/3/12
to play-fr...@googlegroups.com


On Thursday, May 3, 2012 11:20:49 AM UTC-4, tonyb wrote:
Works great for me
how can I send a template instead of an inline text?

sendHtml takes a String which could be coming from say a rendered template. using sendHtml will send the email as html.

Hope this helps.

Thanks,
Peter 

Pascale Audet

unread,
Jun 5, 2012, 10:21:38 AM6/5/12
to play-fr...@googlegroups.com
Is it possible that there is such error in the code of Scala?
Here is my compilation error :
You do not have an implicit Application in scope. If you want to bring the current running Application into context, just add import play.api.Play.current
val mail = use[MailerPlugin].email
              ^

When I do it, application.conf doesn't compile for this part, it write that I have to add double quotes :
smtp.host (mandatory)
smtp.port (defaults to 25)
smtp.ssl (defaults to no)
smtp.user (optional)
smtp.password (optional)

Thanks for help,
Pascale

Paulo "JCranky" Siqueira

unread,
Jun 5, 2012, 10:26:33 AM6/5/12
to play-fr...@googlegroups.com

You mean you added the suggested import and then got the double quotes error?

[]s,

Paulo "JCranky" Siqueira
http://jcranky.com

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/6sLio3hVrosJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

Pascale Audet

unread,
Jun 5, 2012, 10:41:32 AM6/5/12
to play-fr...@googlegroups.com
Yes

2012/6/5 Paulo "JCranky" Siqueira <paulo.s...@gmail.com>



--
Pascale Audet

Pensez Vert ...  Pensez uniVers ...  Pensez-y ! 

Devez-vous vraiment imprimer ce message ? 
Si oui, n’oubliez pas de le recycler ! 

Jay

unread,
Jun 5, 2012, 11:43:17 AM6/5/12
to play-fr...@googlegroups.com
You should set it up like so
smtp.host=hostname
smtp.port=port
smtp.ssl=true or false
smtp.user=emailaddress
smtp.password=yourPassword


So it would look something like this

smtp.host=smtp.gmail.com

smtp.port=587

smtp.ssl=true

smtp.user="dmsho...@gmail.com" <- needs double quotes

smtp.password=blahblah


On Tuesday, June 5, 2012 8:41:32 AM UTC-6, Pascale Audet wrote:
Yes

2012/6/5 Paulo "JCranky" Siqueira <paulo.s...@gmail.com>

You mean you added the suggested import and then got the double quotes error?

[]s,

Paulo "JCranky" Siqueira
http://jcranky.com

Em 05/06/2012 11:21, "Pascale Audet" <audetp...@gmail.com> escreveu:
Is it possible that there is such error in the code of Scala?
Here is my compilation error :
You do not have an implicit Application in scope. If you want to bring the current running Application into context, just add import play.api.Play.current
val mail = use[MailerPlugin].email
              ^

When I do it, application.conf doesn't compile for this part, it write that I have to add double quotes :
smtp.host (mandatory)
smtp.port (defaults to 25)
smtp.ssl (defaults to no)
smtp.user (optional)
smtp.password (optional)

Thanks for help,
Pascale

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/6sLio3hVrosJ.
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Pascale Audet

unread,
Jun 5, 2012, 12:20:14 PM6/5/12
to play-fr...@googlegroups.com
Thanks! I forgot the double quote for the email!

2012/6/5 Jay <cain...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/2GTxnbR7Y8YJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Pascale Audet

unread,
Jul 23, 2012, 9:21:24 PM7/23/12
to play-fr...@googlegroups.com
Replace this :
    import com.typesafe.plugin.MailerPlugin
    import com.typesafe.plugin.use

by this :
    import com.typesafe.plugin._

Salil Wadnerkar

unread,
Jul 23, 2012, 9:23:34 PM7/23/12
to play-fr...@googlegroups.com

I did that first and it did not work. I got the exact same error.

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/y4hYkUDl3OoJ.

Pascale Audet

unread,
Jul 23, 2012, 9:32:33 PM7/23/12
to play-fr...@googlegroups.com
K, I got that error now. Let the import as I said, and create a new file conf/play.plugins with that content :
"1500:com.typesafe.plugin.CommonsMailerPlugin"

Have a good day!

Pascale Audet

unread,
Jul 23, 2012, 9:33:23 PM7/23/12
to play-fr...@googlegroups.com
*** without the double quote ***


On Sunday, April 22, 2012 1:40:02 AM UTC-4, Joe Wyrembelski wrote:

Salil Wadnerkar

unread,
Jul 24, 2012, 1:48:30 AM7/24/12
to play-fr...@googlegroups.com
Thanks a lot Pascale for your timely help. It worked like a charm!
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/v0kaCro1EYIJ.

flukito

unread,
Aug 2, 2012, 4:39:19 PM8/2/12
to play-fr...@googlegroups.com

Hi All,

I followed the steps provided above, setting up Build.Scala and play.plugins, but I kept getting this error on compilation:
update: sbt.ResolveException: unresolved dependency: org.ow2.spec.ee#ow2-atinject-1.0-spec;1.0.10: several problems occurred while resolving dependency: org.ow2.spec.ee#ow2-atinject-1.0-spec;1.0.10 {compile=[compile(*), master(*)], runtime=[runtime(*)]}:
[error] several problems occurred while resolving dependency: org.ow2.spec#ee;1.0.10 {}:
[error] several problems occurred while resolving dependency: org.ow2.spec#parent;1.0.10 {}:
[error] several problems occurred while resolving dependency: org.ow2#ow2;1.3 {}:
[error] Local Play Repository: unable to get resource for org/ow2#ow2;1.3: res=/usr/local/play-2.0.2/repository/local/org/ow2/ow2/1.3/ow2-1.3.jar: java.net.MalformedURLException: no protocol: /usr/local/play-2.0.2/repository/local/org/ow2/ow2/1.3/ow2-1.3.jar

The error has a long list, but some of the messages are similar. Is there some steps that I am missing?
Thanks for the help.
Reply all
Reply to author
Forward
0 new messages