0

Im really new to iOS development, but I have some experience in OSX. I am trying to make an app where the users fills out text fields with information and then presses a submit button. The contents of the fields that they filled out are then automatically sent to me via an email.

I built a similar OSX application that could do this, but I cannot figure out how to do it on iOS.

I do not want to use the MessageUI.framework because, as far as I can tell, the user must press the send button after it brings up the email form. I just want it to send in the background.

I have no problem hardcoding in the email address and password, or using the same email for send and receive. ex: to: me@gmail.com from: me@gmail.com

Any pointers would be sweet!

Andrew Doig
  • 25
  • 2
  • 9
  • This will let you send an email in the background, with an external email account: http://stackoverflow.com/questions/6284599/mfmailcomposeviewcontroller-question-locking-the-fields – Luke Mar 05 '13 at 18:29

2 Answers2

0

You are going to need to make a custom form and then send all of the fields in the form as POST parameters to a custom API that you make on some server. Then you can just redirect that as an email to yourself through something like SMTP

rooster117
  • 5,432
  • 1
  • 18
  • 19
0

You have two options if you do not want to show the mail composer window to the user

  1. Use an SMTP Client for iOS like this one and send the email from your app with the email id and password hard-coded in the app. But if you want to change the email id or change the password in the future, you'll need to update the app. So this is a less desirable solution

  2. Create a web script on your server which accepts the form fields to be submitted by the user. Then from this web script, send the email to your email id (for instance, if you use a PHP script, use the mail function to send the email). Call this script in the app using NSURLConnection.

lostInTransit
  • 68,087
  • 58
  • 193
  • 270
  • I think what I'm aiming for would be the first option here, and I understand the limitations, but they will be fine for me. I downloaded that SMTP client, ran it, changed the email info in it and hit send, but it gave me an error that says "-2: Unsupported Login Mechanism. Your server's security setup is not supported, please contact your system administrator or use a supported email account like MobileMe." I used a valid gmail account. Any ideas? – Andrew Doig Mar 05 '13 at 20:09
  • Are you using Google's 2-step authentication? That might be causing the issue. What are the other settings you are using (SMTP host)? Is wantsSecure set to yes? – lostInTransit Mar 06 '13 at 04:37