Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-301

E-Mail attachments get ignored via commands endpoint

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • 2.2.6
    • tools
    • None

      Our partner acdsolutions reported a bug in the commands endpoint. I was able to reproduce it and I think this is a problem related to the commands endpoint.

      Steps to reproduce

      1.  Start any Magnolia 6.2.6
      2.  Add the sendMail command under /modules/rest-services/rest-endpoints/commands/enabledCommands
      3. Try to send a mail via the endpoint

      Example request:

      http://localhost:8080/.rest/commands/v2/default/sendMail

      {
        "type": "freemarker",
        "contentType": "html",
        "from":"tobias.kerschbaum@magnolia-cms.com",
        "subject":"subject",
        "to":"tobias.kerschbaum@magnolia-cms.com",
        "templateFile":"",
        "body":"mail body",
        "attachments":[
          {
            "url":"http://designermag.org/wp-content/uploads/2013/09/Awesome-Animal-Logo-Design.jpg",
            "name":"test",
            "fileName":"test",
            "contentType":"image/jpeg",
            "disposition":"attachment",
            "mimeMultipart":"multipart/mixed"
          }
        ]    
      }
      

       

      Expected results

      The E-Mail gets send with an attachment.

      Actual results

      E-Mail is sent but without attachment.

      Workaround

      Development notes

      I debugged the behaviour and I think the problem is as follows:

      • The MailCommand line 106 expects a WebContext in order to check any attachments
      • The CommandManager has a method with and one without an actual context. If no context is set a SimpleContext is created.
      • The CommandEndpoint calls the excuses always without context.

        Acceptance criteria

              Unassigned Unassigned
              tobias.kerschbaum Tobias Kerschbaum
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD