0

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.

beryllium
  • 29,214
  • 15
  • 99
  • 123
Theo
  • 1,203
  • 16
  • 22
  • 1
    Check the accepted answer here - very cool email background sender. http://stackoverflow.com/questions/6284599/mfmailcomposeviewcontroller-question-locking-the-fields – Luke Nov 19 '11 at 13:19
  • Thanks Luke, but I couldn't see how to add an attachment to this. Do you know if it is possible using the code you suggested? – Theo Nov 27 '11 at 21:50
  • Not sure it's supported there, sorry - I'm sure it could be added in though ;) – Luke Nov 28 '11 at 09:05

2 Answers2

5

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.

jrturton
  • 113,418
  • 30
  • 247
  • 261
  • Thinking about it. Surely you could use mailto to spam people if you wanted? It just wouldn't get approved by the app store. So surely they should provide the same option for mfmailcomposeviewcontroller. And if people are not using it in an appropriate way then they should just not approve the app. – Theo Nov 28 '11 at 19:27
  • mailto doesn't send email from the email account configured on the phone without the user OK'ing it first, does it? – jrturton Nov 28 '11 at 20:16
0

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?

Community
  • 1
  • 1
beryllium
  • 29,214
  • 15
  • 99
  • 123