Sending hidden fields via POST in iPhone in-app email

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-04-04T01:01:13Z Indexed on 2010/04/04 1:03 UTC
Read the original article Hit count: 512

Filed under:
|
|

I'm letting my App's user send email from within the app to share some content on myserver. To do so I need to include a button with two bits of data and I want to use POST to keep it somewhat hidden. I've decided to add an html form using POST and two hidden fields in the email rather, like so:

NSString *buttonCode = [NSString stringWithFormat:@"<form method='post' action='http://www.example.com/iphone/nifty.php'>
 <input type='hidden' name='dataOne' value='%@'>
 <input type='hidden' name='dataTwo' value='%@'>
 <input type='submit'value='Submit'></form>",dataOne, dataTwo];
NSString *emailBody = [NSString stringWithFormat:
        @"<b>%@ - %@</b>\n\n<HR WIDTH=200 SIZE=2 COLOR=#755f0f ALIGN=CENTER>\n Here is a email:<br><br>%@", 
         dateString, 
         timeString,
         buttonCode];
[picker setMessageBody:emailBody isHTML:YES];

I've confirmed by looking at the raw source of the email that the form is constructed correctly and I've copied and pasted it into a web page and it works.

So here is the problem. When I click on the button in the received email (using apple's mail client) the dataOne and dataTwo variables don't get passed to my server.

Is there a better way to do this or is the issue with my mail client?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about email