MFMailComposer Send Email Without Presenting the View
Hi,
I have seen a few apps do this know, and I would like to know how. Basically in the app you are asked who you would like to send the email to, and then you would press send, and it will have sent the email without even showing the MFMailComposerViewController.
Yes, they are most definitely creating their own SMTP backend. Why would you need something nefarious like this? Are you creating the next conficker spam botnet for iPhone?
OT: I'm sure there are services available in URL form, that you can use to create a specially crafted web address that will send an email. It probably would need to be done over a NSURLConnection.
No definitely not! I just wondered how they did it. Its a hassle less way of sending email.
Quote:
Originally Posted by iOS IDDQD
Yes, they are most definitely creating their own SMTP backend. Why would you need something nefarious like this? Are you creating the next conficker spam botnet for iPhone?
OT: I'm sure there are services available in URL form, that you can use to create a specially crafted web address that will send an email. It probably would need to be done over a NSURLConnection.
The messageUI framework has setters for the To:, Subject: and Body: lines of the email window. You're looking at two user taps, max, to send an email with it. One tap for the user to bring up the modal window, and one tap to send/cancel. Any user who would rather just tap once I would say is truly lazy =)
lol, your app does need to be 'lazy' compatible too!
Quote:
Originally Posted by iOS IDDQD
The messageUI framework has setters for the To:, Subject: and Body: lines of the email window. You're looking at two user taps, max, to send an email with it. One tap for the user to bring up the modal window, and one tap to send/cancel. Any user who would rather just tap once I would say is truly lazy =)
Tru dat. I created a custom feedback form class. Many users who want support or want to give feedback don't know certain things like what version of the operating system they are on or if they actually have the latest version of the app. If you're interested in it send me a PM so I'm not considered spamming the board.
__________________
iOS IDDQD: God mode for iOS Development!
Father of Kill Stats XD, the premiere stat keeping application for iOS, tracking all of your fps games. Kill Stats XD on the App Store
Nice site, Correct me if I am wrong but you do not need to implement the code in bold as apple will show their own alert if the mailcomposer cannot send mail. Test out the MessageComposer on an iPod Touch, and you will see exactly what I mean.
Code:
if ([MFMailComposeViewController canSendMail]) {
}else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Status:" message:@"Your phone is not currently configured to send mail." delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
[alert release];
}
You should call this method before attempting to display the mail composition interface. If it returns NO, you must not display the mail composition interface.
The messageUI framework has setters for the To:, Subject: and Body: lines of the email window. You're looking at two user taps, max, to send an email with it. One tap for the user to bring up the modal window, and one tap to send/cancel. Any user who would rather just tap once I would say is truly lazy =)
I would like to respond to this, because this is an issue I am facing in my enterprise app. It's not for laziness that this method would be useful; it's so the data presented in the email can't be altered. The method by which the system allows composing and sending emails also allows editing the email. In some cases, with our app, the data's integrity is paramount. To place it at risk of being altered -- either accidentally or on purpose -- is a threat to that integrity.
For example, the information collected in my app is formatted into an email and sent to a server which automatically processes the data. There are some users who don't understand that the processing is done entirely automatically, that no one ever sees the email itself unless it is kicked out for an error. Users have a tendency to place notations or instructions in the body of the text, or may change the subject field to something different, believing that someone will see it and respond to it. It not only doesn't work that way, but if the change affects the way the info is formatted, then the email is kicked out.
There is also the problem of falsifying information intentionally, which is rare, but does happen.
So you see, there are more important considerations for this method than just convenience. I would still like to find a way to skip presenting the email composer and simply send the information directly.