4

First of all, I'm working on an in-house app, so I don't need approval at App Store. I know it wouldn't ever be accepted, but it's a business rule our users share some content of the application, but with a default message and subject, so they can't edit these fields..

Until iOS 5 I was able to navigate by the view hierarchy and let the fields unneditable. But with iOS 6, and the mail on another proccess, I can't do it anymore. I need to block the views for editing (I put a view over all the mail view, except the title bar, and it works, but when the user try to cancel the e-mail, my view is blocking the popover to delete or save draft too) or send e-mails without the UI (I was able to do it with Stealth Messenger based code (https://github.com/0xced/Stealth-Messenger/) at iOS 4 or 5, but now it doesn't work).

I tryed everything I could with private APIs and Objective-C runtime.. I can dismiss the view with sending e-mail ok, but the e-mail itself isn't sent.

Can anybody help me? Does anybody did it?

Thanks in advance..

Luis Jacintho
  • 209
  • 2
  • 4

2 Answers2

4

Take a look at this: Send Email in Background from iOS

IOS doesn't support to mail in background. [...] As an alternate you should implement the WebService for this[...]

Probably the best option is to utilise some server code and call that with NSURLRequest.

Hope that helps.

Community
  • 1
  • 1
  • Thanks! I saw some alternatives using an external e-mail service. But I would like to continue using iOS mail facilities (can send e-mail even if offline that e-mail is queued and sent when internet connection is available). It's a very good feature, because our users visit some clients and internet is not always available. – Luis Jacintho Oct 01 '12 at 16:25
  • 3
    You could implement your own queue system... Obviously the queued message would only get sent when both the internet connection is back on and the app is in the foreground but it sounds like that might be an option? I would set up a core data store and add messages to that when they can't be sent, then check that store on foreground notification/internet reachability and clear them from the store when they've successfully sent. – darrencperry Oct 02 '12 at 00:07
0

I do this in an app of mine. I have a simple PHP script on a webserver that uses the PearPHP mail modules to send SMTP mail. The PHP script takes a few incoming variables, like $toAddress, $subject, $message and then connects to the SMTP server and sends the mail out.

Unfortunately, you're not allowed to subclass the MFMailComposeViewController, and if you were using some sort of Invisible UIView to block fields, that was just a workaround that's probably been broken. (They did the same thing with being able to insert a "." on the NumberPad keyboard)

Daddy
  • 9,045
  • 7
  • 69
  • 98