I am working with an app. In which user requirement is that send patient form via email to specific email account. Problem is that email will be send without showing mfmailcomposeviewcontroller. Mean to say user will press one submit button then email sent to user account without mfmailcomposeviewcontroller from iPhone device. is it possible? Can any one help me ? Please send me any example of that work. I have lot of searching on this point unfortunately I can't found any result.
-
1Try to search on net first. You'll get answer ... – Maulik Nov 21 '13 at 07:07
-
1Looks like you'll need to compose the e-mail yourself and send it via SMTP. – trojanfoe Nov 21 '13 at 07:08
-
You want to send email in background process it is not possible that you can send mail and massage in background process.. For Security Purpose only – Parvendra Singh Nov 21 '13 at 07:16
-
Hint : You could use web service to send mail from your server. – Maulik Nov 21 '13 at 07:21
3 Answers
Apple not providing the Mail frameworks for send email without showing MFMailcomposeviewcontroller.
Sending emails programmatically, without user intrection
, from an iphone application, cannot be implemented using any of the Apple frameworks.
It could be possible in a jailbroken phone
but then it would never see the inside of App Store
.
For original answer :
If you want control of email sending, then it's a better way would be to set up a web service (at your server end)
you can post to using an HTTP request. If you are posting to only one address this can work very well, although you may want to get the user to input their return mail address.

- 1
- 1

- 3,090
- 1
- 20
- 35
This is not supported by the iPhone SDK, probably because Apple doesn't want you to do it.
Why not? My guess: Because it's easy to abuse. If we knew user's email address, we could spam them, we could fake emails from them, etc. Imagine finding out an iPhone app sent an email as you without your knowledge -- not cool, even if the app had good intentions.
So, anything you do to get around that, is likely to get you rejected from the app store.
Having said all that, you could basically write your own smtp interaction code to chat with the user's outgoing mail server. For example, if the user has a gmail account, you could ask them for their email and password, you'd have to know how to talk to the gmail servers, and send email through them.
Going that route means asking the user for their username, password, and either asking for or figuring out their mail server information. Another choice is to send directly from the phone (your own smpt server, not just a client), which is a bit more coding. And if you write your own server, the mail you send is more likely to be blocked since your originating IP might not match the domain on the sender's email.
There also exist some libraries that might help out

- 1
- 1

- 6,394
- 2
- 28
- 35
Bilal, i think you not use this
if ([MFMailComposeViewController canSendMail] )
{
MFMailComposeViewController *mailController = [[MFMailComposeViewController
alloc] init];
[mailController setMailComposeDelegate:self];
[mailController setSubject:@"Patient Form"];
[mailController setMessageBody:increments isHTML:YES ];
[mailController setToRecipients:[NSArray arrayWithObject:@"email id"]];
[self presentViewController:mailController animated:NO completion:nil];
}
use it on the click of submit button, i hope it helps you

- 19,348
- 14
- 82
- 137

- 965
- 7
- 19
-
1
-
but it is not possible my dear friend .....But you can use SMTP for that ,,,,, But it is not guaranty that apple accept it or not – Parvendra Singh Nov 21 '13 at 07:25