parse.com sending transaction emails - ios

I want to send an email whenever someone makes a purchase in my ios App. What is the code to be able to do so?
I tried following the instructions here:
https://www.parse.com/questions/sending-email-with-mandrill-on-ios
but the first part does not make sense. Where do we put the javascript code?
Another requirement - I want to be able to change the email text whenever without releasing an app upgrade.

You put the JavaScript in your back-end web server hosted using the CloudKit APIs at parse.com: Parse JavaScript API. From your question, I'm presuming the back-end will send the email.
If the Parse back-end sends the email, there's no need to push an App Store update to your iOS app to change the email. You may, however, need to push an update to your Parse CloudKit app, depending upon how you've designed the back end.

Related

How to send user input to designated e-mail?

I am developing an iOS app targeting iOS 9 and above using Swift 3 and xCode 8.
I have a "Contact ViewController" which contains multiple forms where user enters its data to submit. Collected data also contains users' e-mail address. I am validating all the information that entered by the user correctly.
So, what I would like to do is my "send" button to send the user's all data to an e-mail address.
Is this possible without using Mail App or its interface? Do I need additional framework for such functionality?
I appreciate your time and sharing your thoughts.
This is not possible secretly. You can't send an email from the users device via the Apple Mail app because the system will not allow that. You can prepare an email with all the data that opens and let the user send it to you by tapping "Send" in the NavigationBar. So yes, you would need another framework to do that.
But I would not use emails to do that. Just use a server you send the data to or a service like Firebase.
If you really have to send E-mails, and just pushing the data to a backend API is not enough:
This is not possible using built-in functionality, but you could leverage an external mail delivery service like Mailgun to send your mails. (From a security standpoint, this should be handled by a server and not by the app itself however.)

iOS - Can application send and receive messages to/from server?

I'm working on an iOS project. For this project I need an authentication system. However, if it's possible I don't want to use already built two-factor authentication systems such as Plivo or Sinch. I want to implement this feature of our application.
For this purpose, I need three things:
My application should get the phone number of the user and send it to server.
Server should send a sms to the number of user and my application should be able to read this message to get authentication code sent by server.
Application should be able to remove messages of this procedure from inbox and outbox of the iPhone used by user.
Now, i'm asking that can I implement this feature? I know this is a weird question but i've searched the Internet all day and could not get a certain answer. Thus I'll appreciate if someone informs me shortly.
Yes, you can that.
Your app can't read SMS messages received through the Messages app. The user would need read the message and note the code. Then switch back to your app where they could then type in the received code.
Your app can't access or modify any SMS messages received through the Messages app. The user would need to delete the message if they wanted to.

Consuming external json with parse.com

I'm working on an iOS application developed with Swift. The application is going to need notifications to receive alerts when certain events occur.
To handle push notifications I'm using parse.com. I was able to create an account and integrate push notifications into my application, as it's explained in the Parse.com guide, and are working fine when I send something from the Push section.
What I'm trying to do, and I cannot figure it out, is consume a 3rd party JSON, process that JSON to check some status and report, to the users that are using the application, a status change via a push notification. I know I should process all this in the backend/server side and then push the result or what I'm trying to notify, but I don't know what to do.
Ex. of What I'm trying to archive:
3rd party website ---(json)---> parse.com ---(push notification)--->
My App
I'm aware the tools that Parse.com provides, such as REST API, Cloud Code, Webhooks and Jobs, but I'm totally lost here! I cannot find any guide or documentation that allows me to do what I previously described. I don't even know if its possible, and the documentation at parse.com it's not necesarily up to date.
I hope anyone can help me, or guide me, if parse.com it's not enought for my purpouse.
Thanks for reading.
I would suggest looking into Cloud Code or a Job from Parse and seeing if you can get one to run on a time interval to look for updated JSON.
You can decode JSON using JS, which is exactly what Parse Cloud Code is, you actually write it out on your own computer and then upload it. I've only use the afterSave functions. I would think you probably have to keep some type of object in parse to see what is updated and notify who ever needs to notified when that data is updated.
Also, you'll probably want to pass something to the app to actually update when the user selects the push alert. You can do this in the push alert itself. It converts to a dictionary in the app delegate's method for handling received notifications or launching with one.
Alternatively, if the web server is under your control, you can create a PHP script that will trigger the push to parse.
My best shot at this (after not having used Parse for a long while) would be to set up a Job on Parse that queries the 3rd-party service, and takes that response and throws it into a Cloud Code function, which in turn parses out that JSON and sends off a notification.
Parse's reference materials would probably be a good starting point.
The toughest part for you is the up-to-date-ness of your data. Since you're still polling that 3rd-party service at a regular interval, it's going to be a trade-off between freshness of updates and frequency of jobs (which cost money at a certain scale).

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

Skpsmtpmessage API

My application need to send mail on background without display any mail compose screen so i got suggestion as skpsmtpmessage api .shall i use this api for my application and any apple rejection by using this api.I am new to ios application development so tell me the way to use third party api in applicatiion without apple rejection.can any one help me.
As Sudha and MarJamRob answered, your app can be rejected if you are sending mails in background but there is a workaround to this.
You can create a web method which takes the mail ids and content to be mailed as inputs and mails to the intended email ids. Call this method from within your iOS app with appropriate parameters. In this way you can fulfill your purpose without a risk of rejection as your app is not mailing in background but you are only giving a call to remote method!
You will get an Apple rejection for sending background e-mail without using the compose screen, or an in-app compose screen (g-mail).
Yes, your application will be rejected from apple because it is illegal to sending background email without display mail compose screen or without user interaction ...
...

Resources