5

I have an app where I have a simple form to collect data, and then want to send an email containing that data to a particular email address.

Ideally, I'd just want this to be transparent to the user -they would just press submit/send, and the email would be automatically created and sent in the background to that email address without the user knowing.

I am getting tutorial on this using objective-C but I want to implement this using Swift.

Is there a recommended way to send email in the background?

Sudhir
  • 93
  • 2
  • 6
  • 1
    Apple does not provide any means to send an e-mail without the users interaction. So you will need to use a third party mail library or create some thing yourself. Since asking for libraries is offtopic for stack overflow I suggest you google it. – rckoenes Oct 29 '15 at 10:47
  • What you can do is save the data to a database and then view it/use it. I'm assuming that's what you're trying to do with it. Use Parse.com to save the objects. – Lukesivi Oct 29 '15 at 10:50
  • 5
    There's a similar question - http://stackoverflow.com/questions/29034099/sending-an-automatic-email-with-swift-and-xcode-6 – Stan Sidel Oct 29 '15 at 10:52
  • I've created a video to send emails in the background using mailcore2. It's a very detail video: https://www.youtube.com/watch?v=NkpLqNN8xtU – Charles Xavier Oct 30 '17 at 18:21

2 Answers2

10

Apple do not allow you to send emails in the background without user's interaction. The only way you can do this is to use a server to send the email.

Swinny89
  • 7,273
  • 3
  • 32
  • 52
0

There is no way you can do this. Apple doesn't allow sending E-Mails in background. You can set any information about the receiver content and so on, but you also don't know if the user did change anything because you can't access the content through any delegate. Of course you can by the private API but then it would be rejected in the review process.

Alex Cio
  • 6,014
  • 5
  • 44
  • 74