Marko
Marko

Reputation: 72222

Sending HTML emails from iPad application

We're working on an iPad application and would like to be able to send an HTML email with a few tables and a graph directly from the iPad.

One solution we currently have is to send the email to our web server and have it process the email but the downside of this is that we want the email to come from the users email address that's configured on the iPad.

Can we just use the API to send an email? The Mail app doesn't even need to be open as far as we're concerned, but it's not a big deal if it does open.

We're using MonoTouch but iOS examples are welcome too.

Thanks in advance
M

Upvotes: 2

Views: 8137

Answers (3)

nylund
nylund

Reputation: 1105

Use MFMailComposeViewController and setMessageBody,

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
NSString *emailBody = @"<html>....</html>";
[picker setMessageBody:emailBody isHTML:YES];

Upvotes: 0

madoke
madoke

Reputation: 873

Anomie is right. I used this code in my iPhone apps, but it probably works in ipad too:

http://mikebluestein.wordpress.com/2009/12/11/sending-mail-from-an-iphone-app-with-monotouch/

you can specify if your message is an HTML message in the SetMessageBody() method.

Upvotes: 1

Anomie
Anomie

Reputation: 94794

The only way to send mail from your app from the device is using MFMailComposeViewController. It can send HTML mail, but there does not seem to be any way to do a multipart/related message. It also requires that the user be allowed to edit the message before sending, and cannot force the message to be sent.

Upvotes: 3

Related Questions