Sunday, March 24, 2013

Can't retrieve files from request object


Hi there - I have a very small application that works as follows:

1.  I send an email to mailgun
2.  Mailgun parses the message and POST it to my web page/controller over HTTP
3.  My application has a single controller (no models or views) with one method that currently only does this:
$this->log($this->request->data);
4.  Here is some additional information on the attachment fields from mailgun when the POST to my service.

attachment-xstringattached file ('x' stands for number of the attachment). Attachments are handled as file uploads, encoded as multipart/form-data.
content-id-mapstringJSON-encoded dictionary which maps Content-ID (CID) of each attachment to the corresponding attachment-x parameter. This allows you to map posted attachments to tags like <img src='cid'> in the message body.

Anyhow, the issue is that I can't seem to figure out how to retrieve the attachment-1, nor can I see it in  the response.   

Here is a dump of my request object received when a new message is received.  Note that the [content-id-map] and [attachment-count] are both there.   The [attachment-1] is also referenced in the [content-id-map]

*******
    [recipient] => testreceiver@ducksoup.mailgun.org

    [sender] => mday@gmail.com

    [subject] => SUBJECT OF MESSAGE

    [from] => mdayt <mday@gmail.com>

    [X-Envelope-From] => <mday@gmail.com>

    [Return-Path] => <mday@gmail.com>

    [From] => mday <mday@gmail.com>

    [Content-Type] => multipart/alternative; boundary="Apple-Mail=_EC882749-B764-43B-9769-3F4850B9F3"

    [Subject] => SUBJECT OF MESSAGE

    [Date] => Wed, 20 Mar 2013 06:02:00 -0400

    [References] => <8A01E-CD7D-4599-B1C5-F8774624C@gmail.com>

    [To] => "testreceiver@ducksoup.mailgun.org" <testreceiver@ducksoup.mailgun.org>

    [Message-Id] => <9589-5462-4BA1-93B9-9E4E8BEC1BDA@gmail.com>

    [Mime-Version] => 1.0 (Mac OS X Mail 6.3 \(1503\))

    [X-Mailgun-Incoming] => Yes

    [token] => 48km59sauktziefvfs6ndfalfh5kr0emkroa0g78irt8

    [signature] => d525e5b382f4182d035019c1e300d2f643d1d242a6552c04650d84f0

    [attachment-count] => 1

    [body-plain] => > BODY OF MESSAGE.    MESSAGE SHOULD HAVE 1 ATTACHMENT

   [stripped-text] => > BODY OF MESSAGE.    MESSAGE SHOULD HAVE 1 ATTACHMENT

    [content-id-map] => {"<99098F-9DD-44A9-AC75-B652BA@vlan1.phub.net.cable.rogers.com>": "attachment-1"}

)

Any assistance that can be provided would be a HUGE help!!!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: