You will need to the MessageUI.framework reference to your project.
Add the following to your .h file
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>
Add the delegate <MFMailComposeViewControllerDelegate>
Create a couple methods similar to the following in your .m file.
-(IBAction)checkCanSendMail:(id)sender{
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil) {
if ([mailClass canSendMail]) {
[self displayComposerSheet];
}
else {
//Display alert for not compatible. Need iPhone OS 3.0 or greater. Or implement alternative method of sending email.
}
}
else {
//Display alert for not compatible. Need iPhone OS 3.0 or greater. Or implement alternative method of sending email.
}
}
-(void)displayComposerSheet {
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"Email Subject"];
//Set our to address, cc and bcc
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"];
//NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]",@"[email protected]",nil];
//NSArray *bccRecipients = [NSArray arrayWithObjects:@"[email protected]",@"[email protected]",nil];
[mailer setToRecipients:toRecipients];
//[mailer setCcRecipients:ccRecipients];
//[mailer setBccRecipients:bccRecipients];
NSString *emailBody = @"\
<html><head>\
</head><body>\
This is some HTML text\
</body></html>";
[mailer setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:mailer animated:YES];
[mailer release];
}
Apple sample code with more instructions available at: http://developer.apple.com/iphone/library/samplecode/MailComposer/
I know this doesn't use the webView but it does allow you to create HTML emails from within your application.