mail application are not launching!
<p>i am trying to implement the functionality of email in my application. i have added MessageUI-framework, along with header and MFMailComposeViewControllerDelegate  protocol but i am facing problem. here is my code:</p>

<pre><code>- (void)viewDidLoad {
    [super viewDidLoad];
if(isViewPushed == NO) {
        self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] 
                                                  initWithBarButtonSystemItem:UIBarButtonSystemItemCompose 
                                                  target:self action:@selector(email)] autorelease];
        }
    }
-(void) email
{
    NSMutableString *emailBody = [[[NSMutableString alloc] initWithString:@"&lt;html&gt;&lt;body&gt;"] retain];

[emailBody appendString:@"&lt;p&gt;type text here&lt;/p&gt;"];
    UIImage *emailImage = [UIImage imageNamed:@"20-gear2.png"];
    NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(emailImage)];
    [emailBody appendString:[NSString stringWithFormat:@"&lt;p&gt;&lt;b&gt;&lt;img src='data:image/png;base64.....,.......%@'&gt;&lt;/b&gt;&lt;/p&gt;",imageData]];
    [emailBody appendString:@"&lt;/body&gt;&lt;/html&gt;"];
    MFMailComposeViewController *emailDialog = [[MFMailComposeViewController alloc] init];
    emailDialog.mailComposeDelegate = self;
    [emailDialog setSubject:@"My Inline Image Document"];
    [self presentModalViewController:emailDialog animated:YES];
    [emailDialog release];

    if(! [MFMailComposeViewController canSendMail])
    {
        UIAlertView *cantMailAlert  = [[UIAlertView alloc]
                                       initWithTitle:@"cant email"
                                       message:@"nt able to send email"
                                       delegate:NULL
                                       cancelButtonTitle:@"ok"
                                       otherButtonTitles:NULL];

        [cantMailAlert show];
        [cantMailAlert release];
        return;
    }
    MFMailComposeViewController *mailController = [[[MFMailComposeViewController alloc] init] autorelease];
    [mailController setMessageBody:@"can send my mail" isHTML:NO];
    mailController.mailComposeDelegate = self;
    [self presentModalViewController:mailController animated:YES];
}


- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
    if (error)
    {
        UIAlertView *cantMailAlert  = [[UIAlertView alloc]
                                       initWithTitle:@"mail error"
                                       message: [error localizedDescription]
                                       delegate:NULL
                                       cancelButtonTitle:@"ok"
                                       otherButtonTitles:NULL];

        [cantMailAlert show];
        [cantMailAlert release];
        return;
    }
    NSString *resultString;
    switch (result)
    {
        case MFMailComposeResultSent:
            resultString = @"sent mail";
            break;

        case MFMailComposeResultSaved:
            resultString = @"saved";
            break;
        case MFMailComposeResultCancelled:
            resultString = @"cancel";
            break;
        case MFMailComposeResultFailed:
            resultString = @"failed";
            break;
    }

    if (resultString = @"saved")
    {
        NSString *msg = [NSString stringWithFormat:@"%@ at %@\n", resultString, [NSDate date]];
        UIAlertView *MailAlert  = [[UIAlertView alloc]
                                   initWithTitle:@"status"
                                   message: msg
                                   delegate:NULL
                                   cancelButtonTitle:@"ok"
                                   otherButtonTitles:NULL];

        [MailAlert show];
        [MailAlert release];
        return;
    }

    [controller dismissModalViewControllerAnimated:YES];
    [controller release];
    //[self email];
}
</code></pre>

<p>but when i click on mail button then applictaion terminates and starts loading . it says can't able to store privious value!! </p>
