9

I need to be able to send a pre-formatted email or SMS text message programmatically from within an iphone app. Can this be done? I have looked at apple's MFMailComposeViewController class, but this "provides a standard interface that manages the editing and sending an email message" and the MFMessageComposeViewController class also has it's own "standard system interface for composing SMS text messages". These allow you to present an interface to the user where they have to fill in all the data and then explicitly press a send button.

I cannot use this boilerplate functionality.

I need to be able to send a message without presenting any interface to the user. I know this sounds evil, but actually it is for a commercial application which needs to communicate to a user group in a central office when users in the field have performed specific actions out in the field.

Has anyone found a solution to this?

4

8 回答 8

12

After much investigation, I have found that sending emails programmatically, without user intervention, from an iphone application, cannot be implemented using any of the apple frameworks.

于 2011-02-15T08:23:17.643 回答
5

Set up a web service 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.

Otherwise only the standard dialog is available (this relies on using whatever account they've setup on the device).

于 2010-11-07T22:41:04.623 回答
3

Here are a few SMTP API's that work on OS X. They might work on iOS as well.

  • Pantomime
  • MailCore
  • EdMessage
于 2010-11-07T21:28:31.633 回答
1

Only Possible via Web Interface, you can not hide the Interface , this is as per apple Guidlines to Developer and as per documentation

于 2010-12-02T04:04:23.767 回答
1

Looking for a solution to such a problem, I found something interesting here: How to send mail from iphone app without showing MFMailComposeViewController?

I hope this will be useful!

于 2018-01-22T14:05:24.057 回答
0

I have no experience with iOS, but I have enough experience with email protocols to say I'd be very surprised if a client application could send email without accessing a server. More than likely, the email will be sent using the SMTP protocol and therefore must be sent using an SMTP server. Choosing how you connect to that server is about the only option you have. You could connect to a server-side script (such as php) to generate and send the email, or you may be able to create a socket and connect directly to port 25 on the SMTP server and still generate the email from you client application.

Check out:

于 2010-11-07T20:54:55.670 回答
0

This is standard not possible. If you can't use the standard dialog you need to use SMTP.

SMS is the same, use the dialog of use a webbased sms service (most of these cost some money).

于 2010-11-07T21:14:24.507 回答
0

You could always do a low level telnet using SMTP protocol to a known mail server to send a message. I don't know if Apple will reject the app, but SMTP is damned simple.

于 2011-08-17T17:13:26.707 回答