Using MFMailComposeViewController without presenting the view controller - ios

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?

Related

Sending a text message without being prompted [duplicate]

Is it possible to send sms via iphone without user intervention? I already know about MessageUI framework and MFMessageComposeViewController class, but this option requires user to click Send button when MGMessageComposeViewController is presented. I would like the device to automatically, without my help send a text message when certain conditions are met. (I have some sensors connected to the device)
No. You can only open a message ready to send but you cannot send it automatically.
If you want to be able to send sms without user's interaction, consider using some third party gateway. TextMagic provides nice api to send sms, but it is not free. At some point it charges you money. But, they have nice and simple api to use.
Look at this,
http://api.textmagic.com/https-api/textmagic-api-commands#send

Is it possible to send mails periodically from iOS app

I'm developing an app that creates a simple document with basic information created by the app. It won't contain any personal information, but it will contain data created and requested by the user. I want the user to be able to send this to themselves via email. I would also like to add the option for the user to have this file (which updates daily) to be able to send to them automatically every week/month, so they won't have to think about it. The user can set the intervals themselves.
Is this possible? The user will set up this option themselves from a menu, so it's not like they won't know it's happening. Every automatic mail will also contain information on how to turn the option back off again.
Is this possible and is it allowed by Apple?
Thanks for your reply
It is not possible from within the app. A user has to explicitly send the email through the MFMailComposeViewController.
If you want this functionality, you should build a backend for your app.
To clarify, if you want to use the users configured accounts; i.e. the account they use with Mail, then no you cannot do this automatically. The other answers rely on the fact a user enters their POP/IMAP settings, which personally I would never do.
You could use an email service as mandril or mailgun, to send emails "from your app".
Take a look at this: https://github.com/rackerlabs/objc-mailgun
There's a library called MailCore that's incredibly powerful. You can use it to send mail in the background of your app without needing to present the built in mail composer view
https://github.com/MailCore/mailcore2

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).

Resources