MFMailComposeViewController canSendMail - Exchange Active Sync - ios

I'm writting an iOS application, and I allow users to send e-mail from my application.
To detect if they are able to send email, I use the method [MFMailComposeViewController canSendMail].
It works well except if I have an Exchange Active Sync account register. In this case, the canSendMail method returns false !
Anybody know why it seems that MFMailComposeViewController does not recognize my Exchange account as an email account? And what I could do?
Thank you for your help.

Do you have the ability to test with a phone that has an Exchange Active Sync account right now? If not try to get one.
Then see what happens if you just ignore that flag and try to send mail anyway. If in the end you can send email, then at least for the time being you could pop an ActionSheet that says "If you are using 'Exchange Active Sync', tap Continue, otherwise you should Cancel and configure a Mail account". This would at least let you continue working til Apple fixes it.
In any case you should enter a bug on this with Apple (bugreporter.apple.com).

It was a problem with my MobileIron configuration. The certificate I received from the MDM does not allow me to send email from another application than Mail.
So: All works fine with Exchange and MFMailComposeViewController.

Related

How to send SMS on the iPhone without pressing send button? (If just for demo, not for the Appstore)

I am working on an app that can automatically send a message to some specific ones (either emails or SMS) under some dangerous circumstances.
When someone is in danger, he or she has no time to press the send button. Is it possible for the user to approve sending messages in the app in advance, so the app can automatically send emails or SMS to others without telling the user?
I searched in StackOverflow, but found no similar answers.
This is just for a demo. It does not need to be approved by Apple.
Thanks in advance!
Take a look at the ChatKit framework.
It uses iOS private APIs to do what you want to achieve. Don't try to submit it to Apple though.
With this framework, you can programmatically compose and send text messages through iMessage/SMS.

How to send an email +attachment w/o showing the composer

I have inherited an app that, when certain conditions are met, will email data to a known server. The way the previous version worked is that the MFMailComposeViewController would slide up and the user could enter add'l info and then hit send. What we really want to do is send an email programmatically, transparently to the user (i.e. no visual representation unless it fails).
Is this possible, or does Apple not like apps to do this?
Thanks for any help.
IOS doesn't support to mail in background.
These are some questions asked previously on same topic.
1.Send Email in Background from iOS
2.How to send an email to a receipent in background in iOS5?
this might be useful to you.
http://iosameer.blogspot.ca/2013/01/sending-e-mail-in-background-from-ios_25.html
one more thing you can do is lock the fields in mail composer view.
Locking the Fields in MFMailComposeViewController

How to send a mail without disclosing recipients mail id in ios

All I am developing an iPhone application in which I have to send mail to recipient without showing email id and the MFMailComposer UI view (i.e without user interaction and also user cant know who is the recipient). Can please tell me how to achieve this?
You cannot send Email without user acceptance. But there are a lot of web-services in internet which can send Email. I guess some app uses those services or uses own.
See also How can I send mail from an iPhone application
You can create a PHP webpage which uses the mail function, just a couple of lines of code.
Then just call the url to that php webpage from your app!

Possible to send automated email?

The iOS SDK class MFMailComposeViewController can be used to let the user compose an email message.
What I'd like to do, is for the iOS app to send an email in the background, with no user interaction. Is this at all possible/allowed in the iOS SDK?
Nope. There isn't any API available to do this. You'd need to roll your own SMTP client and have the user enter credentials into your application. On top of that Apple may not approve this.
Unfortunately, I don't think Apple would ever allow this because (for example) then you could just get everyone's email address by auto-sending mail to yourself. :(
I actually wanted to implement something like this for the express purpose of alerting me when a critical error happens on an app in the app market.
Best solution would be to create an API (just ping a php file or something), and have it send the relative alert message to your email).

Using MFMailComposeViewController without presenting the view controller

I am using MFMailComposeViewController to send an email with an attachment. In all the guides it chooses to present the view controller as a modal view so that the user can change the fields and choose to send or cancel.
I don't want people to be able to change the information that I have put in, so I was wondering if I could force it to send the email without going to the modal view?
I am aware of using a url with mailto but believe you can't add an attachment.
If anyone knows if this is possible or even better if they know how to do it I would really appreciate the assistance.
Many thanks.
No, you can't do this with MFMailComposeViewController. Apple is very specific in the docs that sending email is under the users control, not your apps. You are sending email from the users account, you can understand why access to the email is restricted I this way - a spambot would be trivial to make if this were not the case.
For the above reason I don't think you'd get an app which sends its own emails from the users account approved for the app store.
You cannot send SMS/Email without user acceptance. But there are a lot of web-services in internet which can send SMS/Email. I guess some app uses those services or uses own.
See also: How can I send mail from an iPhone application?

Resources