#444 ✓wontfix
Olivier Lecrivain

Cannot send email with GAE module

Reported by Olivier Lecrivain | November 26th, 2010 @ 04:23 PM

Framework version: play-1.1
GAE module version: gae-1.1
Platform you're using: ubuntu 10.04

Reproduction steps:

Send mail fails when using gae-1.1 module :

play.exceptions.MailException: Error while sending email

at play.libs.Mail.sendMessage(Mail.java:193)
at play.libs.Mail.send(Mail.java:62)
at play.mvc.Mailer.send(Mailer.java:346)
at notifiers.Mails.test(Mails.java:12)
at controllers.Application.index(Application.java:9)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:408)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:403)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:176)
at Invocation.HTTP Request(Play!)

Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : null:25

at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242)
at org.apache.commons.mail.Email.send(Email.java:1267)
at play.libs.Mail.sendMessage(Mail.java:191)
... 8 more

Caused by: javax.mail.SendFailedException: Send failure (javax.mail.MessagingException: Converting html body failed)

at javax.mail.Transport.send(Transport.java:163)
at javax.mail.Transport.send(Transport.java:48)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
... 10 more

Caused by: javax.mail.MessagingException: Converting html body failed

at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:211)
at javax.mail.Transport.send(Transport.java:95)
... 12 more

If I remove the gae module, mails work perfectly!

Details: I have attached a very basic play project reproducing the bug.

Comments and changes to this ticket

  • Nicolas Leroux

    Nicolas Leroux December 5th, 2010 @ 08:14 PM

    • State changed from “new” to “opinion”
    • Assigned user set to “Nicolas Leroux”

    GAE has his own email service. I don't think this is a bug in play... However we could allow the GAE plugin to provide his own email binding?

  • Guillaume Bort

    Guillaume Bort December 5th, 2010 @ 10:09 PM

    On GAE it should already use the JavaMail session provided by Google. The sample application use emails; you can check.

  • Olivier Lecrivain

    Olivier Lecrivain December 5th, 2010 @ 10:29 PM

    Do you know where can I find appengine sources? Can't find them...

  • Erwan Loisant

    Erwan Loisant December 7th, 2010 @ 10:50 AM

    Do you mean the sources of the play-gae module? That would be:
    https://github.com/guillaumebort/play-gae

  • GrooveSAN

    GrooveSAN December 13th, 2010 @ 01:31 AM

    Guys,

    I get the very same error than olecrivain with a play 1.1 + gae module 1.4.
    The Mock Mailer works as expected locally, but GAE is failing :

    Caused by: javax.mail.MessagingException: Converting html body failed
        at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:211)
        at javax.mail.Transport.send(Transport.java:95)
    

    It seems to me that an old project I implemented with an older GAE module was working OK on production.
    Could one of you just try to reproduce the issue with olecrivain's attached project?

    Thx in advance.

  • GrooveSAN

    GrooveSAN December 13th, 2010 @ 01:33 AM

    (btw, the play-lists gae demo code source seems to be missing from the Play 1.1 distribution)

  • GrooveSAN

    GrooveSAN December 15th, 2010 @ 10:46 PM

    Ok, so after some more investigation, I can reproduce locally.

    Here is the exception which is printed when trying to send a MIME Multipart e-mail (using play.mvc.Mailer + an HTML view) :

    Exception in thread "DataHandler.getInputStream" java.lang.ClassCastException: javax.mail.internet.MimeMultipart cannot be cast to java.lang.String
        at org.apache.geronimo.mail.handlers.TextHandler.writeTo(TextHandler.java:143)
        at javax.activation.ObjectDataContentHandler.writeTo(Unknown Source)
        at javax.activation.DataHandler$1.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    

    I don't know exactly if this error could be prevented by an update in the play gae module. Could you please have a look?

    Sending a pure text e-mail (play.mvc.Mailer + txt view) works ok on GAE.

  • obscenity

    obscenity February 3rd, 2011 @ 09:07 AM

    I still have the same problem. Sending text mail works on GAE, but not html (no attachments). Play 1.1, GAE module 1.4.

  • benoit Ponsero

    benoit Ponsero June 7th, 2011 @ 09:36 AM

    i try last version on of gae module on github (compatible appengine 1.5) and it remains the same.

    does anyone fix this bug ?

  • Steren

    Steren September 18th, 2011 @ 09:25 AM

    I have the same issue and errors on Play 1.2 and GAE 1.4.
    I'm using a play.mvc.Mailer with .txt and .html templates.

    Sending pure text work on GAE and locally.

  • Steren

    Steren September 18th, 2011 @ 09:53 AM

    If I don't use the play.mvc.Mailer but a direct HtmlEmail, it works locally with mock Mailer but not on GAE:

    HtmlEmail email = new HtmlEmail();
    email.addTo("info@lunatech.com");
    email.setFrom(sender@lunatech.com", "Nicolas");
    email.setSubject("Test email with inline image");
    // set the html message
    email.setHtmlMsg("<html>Zenexity logo</html>");
    // set the alternative message
    email.setTextMsg("Your email client does not support HTML messages, too bad :(");
    Mail.send(email);
    

    on GAE, sadly :

    play.Logger niceThrowable: 
    
    @67n43k07o
    The email has not been sent
    
    Mail error (In /app/controllers/Application.java around line 183)
    A mail error occured : Error while sending email
    
    play.exceptions.MailException: Error while sending email
        at play.libs.Mail.sendMessage(Mail.java:195)
        at play.libs.Mail.send(Mail.java:64)
        at controllers.Application.testMail(Application.java:183)
        at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_$1.run(Method_.java:165)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.privilegedInvoke(Method_.java:163)
        at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke_(Method_.java:124)
        at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke(Method_.java:43)
        at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:546)
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:500)
        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:476)
        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:471)
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:159)
        at play.server.ServletWrapper$ServletInvocation.execute(ServletWrapper.java:540)
        at play.Invoker$Invocation.run(Invoker.java:265)
        at play.server.ServletWrapper$ServletInvocation.run(ServletWrapper.java:531)
        at play.Invoker.invokeInThread(Invoker.java:67)
        at play.server.ServletWrapper.service(ServletWrapper.java:130)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
        at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:97)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
        at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:249)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
        at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
        at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:391)
        at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:160)
        at java.lang.Thread.run(Thread.java:679)
    Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : null:25
        at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242)
        at org.apache.commons.mail.Email.send(Email.java:1267)
        at play.libs.Mail.sendMessage(Mail.java:193)
        ... 42 more
    Caused by: javax.mail.SendFailedException: Send failure (javax.mail.MessagingException: Converting attachment data failed)
        at javax.mail.Transport.send(Transport.java:163)
        at javax.mail.Transport.send(Transport.java:48)
        at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
        ... 44 more
    Caused by: javax.mail.MessagingException: Converting attachment data failed
        at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:231)
        at javax.mail.Transport.send(Transport.java:95)
        ... 46 more
    
  • Nicolas Leroux

    Nicolas Leroux September 18th, 2011 @ 06:18 PM

    • State changed from “opinion” to “confirmed”
  • Steren
  • Nicolas Leroux

    Nicolas Leroux January 6th, 2014 @ 09:35 PM

    • State changed from “confirmed” to “wontfix”
  • Quentin0

    Quentin0 September 12th, 2018 @ 07:26 PM

    The whole post is actually about the use of GAE module. People who face problem while not connecting the Email with this kind of module then take a look of this post for getting answer of their questions. So, Its a complete procedure to understand the working. I'm a student and now looking the best place to buy a dissertation and at the same time, I'm glad to get good knowledge about GAE module.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2>Play framework</h2>

Play makes it easier to build Web applications with Java. It is a clean alternative to bloated Enterprise Java stacks. It focuses on developer productivity and targets RESTful architectures. Learn more on the <a href="http://www.playframework.org">http://www.playframework.org</a> website.<br><br>

<h2>Source code is hosted on github</h2>Check out our repository at <a href="http://github.com/playframework/play">http://github.com/playframework/play</a><br><br>

<h2>Contributing, creating a patch</h2> Please read the <a href="http://play.lighthouseapp.com/projects/57987/contributor-guide">contributor guide</a><br><br>

<h2>Reporting Security Vulnerabilities</h2> Since all bug reports are public, please report any security vulnerability directly to <em>guillaume dot bort at gmail dot com</em>.<br><br>

<h2>Creating a bug report</h2> Bug reports are incredibly helpful, so take time to report bugs and request features in our ticket tracker. We’re always grateful for patches to Play’s code. Indeed, bug reports with attached patches will get fixed far quickly than those without any.<br><br>

Please include as much relevant information as possible including the exact framework version you're using and a code snippet that reproduces the problem.<br><br>

Don't have too much expectations. Unless the bug is really a serious "everything is broken" thing, you're creating a ticket to start a discussion. Having a patch (or a branch on Github we can pull from) is better, but then again we'll only pull high quality branches that make sense to be in the core of Play.

Attachments

Referenced by

Pages