views:

10

answers:

1

i hav a button on navigation bar for opening the mail view controller .. i am using view based app and when i tap the button its executes the ibaction i wrote but not presenting the view ....

-(IBAction)mailid:(id)sender{

 MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
 controller.mailComposeDelegate = self;

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 NSString *documentsDirectory = [paths objectAtIndex:0];
 NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Report.html"];

 NSData *myData = [NSData dataWithContentsOfFile:path];

 [controller addAttachmentData:myData mimeType:@"html" fileName:@"Attachment-1"];
 [self presentModalViewController:controller animated:YES];

 [controller release];


}

any help ....

A: 

Not sure if averything else is correct, but mime type should be @"txt/html", not just @"html"

Vladimir
i am using this in ipad app
lak in iphone
@Iak, try to fix mime type... and you should also check if it is possible to send mail using [MFMailComposeViewController canSendMail] call
Vladimir