How to securely email something to myself from an iOS app? - ios

I'd like to implement a feature in my app where the user can enter some data, and upon pressing a submit button the app then logs into an email account and sends me an email (so that I can then view the data the user entered). I don't want to just store my password in plain text in the app, so are there any more secure ways to accomplish this?
I understand that usually it's best to just build a custom backend and have the app make a post request, but that won't be possible here.

Related

how to implement forgotten password functionality for password stored in keychain

I am creating a basic iOS app using objective c where the user needs to register and I am saving the login credentials(username, password and email) in keychain.
I want to give forgot password functionality and was thinking that once the user clicks on forgotten password, I will ask for the user email and match with stored one in keychain and if positive I will send email from the app in background to the user email with password in it.
However I am not sure is this safe and good practice?
I am not using server, so cannot send mail from server.
Or is there any better way to do it. Please suggest?

Automatically sending an activation key by SMS or email after registration

I'm working on a free iOS app; at the end of the registration (when the user has registered a good phone number and good email address) I want the user to enter a code which he has received on his phone or email.
But the problem is how to send automatically a SMS or an e-mail programmatically that contains the code?
I don't want the user to be redirected to a specific view controller to compose a message by himself (like with MFMessageComposeViewController or MFEmailComposeViewController)
just and only just the same appearance of SMS or email sent to users but with a different activation key (for the keys, I think about auto generated keys stored in a database).
And I think about the same way for forgotten identifiers, the user enter his email address or his phone number in a text field, and a message is automatically sent with the password and the username of the user, if the email address or the phone number entered is already existing in the database, if it is not, it shows an alert view with an error.
Does anyone have an idea for how to do this?
You can use the following services Parse.com + mailgun. Search on Parse.com for a tutorial using mailgun and it should accomplish what you are trying to do. On a side not, be careful when creating an app which does not allow the user to use it until they enter some access code, it is against the Apple rules and could lead to rejection.
I assume you have a server that generates this activation code that is sent to the user.
When the user enters the text field with the code he got it should be sent back to the server with an http request (use NSURLConnection ). The server should response to the http request with approval or error whether the code is right, or send the username and password and any other data the user needs to continue.

iphone app is logging out frequently

I've developed an app where in the entered username and password by user is saved using NSUserDefaults.
Any request from user for any service needs this username to be sent. So using NSUserDefaults I'm sending username for each request. Still the iPhone app is logging out without clicking the logout button and starts from the beginning asking for username and password.
As facebook app and others remains once logged in. Please let me know why the app is logging out frequently without clicking logout button.
Thanks in advance.
On launch check if there is a saved username and password, if so use them. When the user enters these save them.
You need to look at the page source from the server for the form request of the credentials, create the form response with the credentials and post it. This is doable and actually not very hard. On one project I did this for auto login and respond to many form requests so the user never saw them.
Do not use NSUserDefaults for credentials, it is not secure. Instead use the Keychain, it is secure.

Is there any way to send the email without opening the MFMailComposeViewController?

I need to send the email without opening the MFMailCompseViewController. I have searched about this and got some point like use the web service and another one is connect with gmail server through ask the emailID and password from the user.
My email format is fixed i just have to send the email to user whose id will be given by the user without showing any thing else.
Your existing research is accurate - you can connect to some web service to send the e-mail automatically, but you can't automatically create, configure and send using MFMailComposeViewController. The user always gets to see the presented controller and choose whether to do any editing and whether to send or not.
There is no way of sending an email directly from iDevice without showing the MFMailComposeViewController.
If it was possible it would be a great tool for mobile distributed spam bots.
Things to consider: MFMailCompseViewController is an interface for the user to compose an email.
If you want to use it, you have to hand over control to it. Apple does not expose the underlying functionality to you: it has to go through this view controller.
If you don't want the user to be aware that you are sending emails on their behalf (I assume it is on their behalf or you wouldn't need the composer view) you are probable doing things a little wrong; why would you want to send an unsolicited email?
If you want to report information from the device, implement a web service and send it to that. Email is meant for correspondence; don't hijack an account.
If you still need an email, have the web service create it

Form submission in iOS app?

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!
You have two options if you do not want to show the mail composer window to the user
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
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.
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

Resources