I have 2 text fields and a send button in a view for reporting explicit content on my app. I want my app to send me an email if the send button is pressed and it should send the contents of both text fields. Is there some swift tool for sending these in the backend?
I have searched elsewhere for answers, but can't find a recent answer anywhere concerning backend email sending with swift apps.
This question has been asked a few times in different ways, but its been like 4 years since it was last asked and I am wondering if anything has changed.
I am using swift and the most recent version of xcode.
Button action so far:
#IBAction func sendReport(sender: AnyObject) {
let username:String = offendingUserUsername.text!
let reportText:String = reportContent.text!
}
For sending emails from your app you need a Transactional email delivery service.
A great service for that is SendGrid. It is very powerful and easy to implement into your app with this library.
It also has a Free plan that lets you send up to 12k emails per month.
You can find the Free plan here
Related
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.)
This question already has answers here:
Send an email from my app without using MFMailComposeViewController
(3 answers)
Closed 5 years ago.
Preface: New to coding but have tried to do expensive research without finding anything that I thought would work---so please go easy
I am attempting to create an app that a user will fill out a form of multiple text fields and then when the submit button is touched, it will send the completed fields in an email to one specific email address.
I am stuck at the process of how to send the email with the data entered. I do not want to do this within the app with MFmailcomposer. Can I do this from a back end like firebase for example, or is there a better way to implement---or is this even possible? Hoping someone can at least point me in the right direction, I feel like Ive been stuck for weeks.
Thx
There are services that will send emails for you (like MailChimp). They have an SDK and you'd have to integrate the SDK into your app. Or you could create your own API and call said API through your app and handle the email notifications in your API. Firebase looks like it has custom email options, but only for the Javascript SDK.
This question already has answers here:
Sending an automatic Email with Swift and Xcode 6
(3 answers)
Closed 7 years ago.
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?
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.
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.
This question already has answers here:
Can I send email programmatically in iPhone app?
(8 answers)
Closed 7 years ago.
I would like my app to send an email to my email address from another one of my email addresses. Basically I would like to program it such that it has the username and password for the sending address in the code so that it can compose and send an email without the user having to do anything.
To make it clearer, this would be to place an order that I would receive via email. The user selects all the options they want in the app then once the order is confirmed the app will send all the details to me via email.
I could not find any information on this, even whether or not it's possible. Every time I tried to search I just came up with results about how to open the mail view in your app, which is not at all what I want.
I don't necessarily need all the code, even if you could point me in the direction of a tutorial or something it would be greatly appreciated!
You cannot send an email on behalf of the user without presenting the standard email view.
However, there are a few services that you can use to accomplish your goal. Have a look at Mandrill or Mailgun.
Short answer: not allowed by Apple.
Long answer: not allowed by Apple because this would allow programmers to send emails from a user's device without their knowledge or consent.
I'm trying to set it up so my user can send a text to a group of people. Now with email it's simple, the URL scheme is just mailto://firstemail#email.com,secondemail#email.com which can then be used with the openURL method.
Naturally when it came to SMS I decided to try sms://2065555555,2061234567 however this doesn't work (it only adds the first number). After browsing Google a bit, I found some older threads claiming that texting to multiple recipients isn't possible using the URL method.
In order to send a message to multiple people, I've gone ahead and added MessageUI to my application, hooked up the MFMessageComposeViewControllerDelegate, and now I can send indeed send messages to multiple people at once. However only from within my own application, which is not what I want. I was hoping there'd be something in the framework that would allow me to take advantage of the multiple recipients functionality and then launch it in the default messenger, but I can't find anything that allows that.
So, in short, is there any possible way I can code my app to populate the default Messages app with multiple recipients?
Edit
Actually I'm certain there must be a way to do it, I just checked the app Cobook and they allow the user to select contacts then launch the Messages app sending a "New Group MMS".
I realize this is a very old question - but I discovered the way to do it recently, and posted about it here:
SMS WatchKit multiple number delimiter
While this answer is watchkit specific, the url is really what you are asking about.
ANSWER:
I found an obscure page that gave me the answer. Turns out it is not documented by Apple anywhere I could find:
let urlSafeBody = messageBody.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLHostAllowedCharacterSet())
if let urlSafeBody = urlSafeBody, url = NSURL(string: "sms:/open?addresses=1-408-555-1212,1-408-555-2121,1-408-555-1221&body=\(urlSafeBody)") {
WKExtension.sharedExtension().openSystemURL(url)
}
The above version will open the messages app on the Apple Watch with multiple recipients pre-populated.
There are many pages that state it isn't possible, but it is. Hooray!
Apple's documentation for the "sms://" URL scheme seems to indicate only one phone number is possible within that URL.
The easiest thing to do here is to continue using MFMessageComposeViewController (which has a look and feel really close to the default Messages.app that people use to send and receive SMS messages).
And
MFMessageComposeViewController has a receipients property which is an array, which means you can have multiple destination phone numbers in your compose view.
Lastly, here is a related question which covers a lot of the same ground you're thinking about here.