- (void)MailButton:(id)sender
{
if ([MFMailComposeViewController canSendMail]) {
//atableView.scrollEnabled=YES;
//[socailNetworkView removeFromSuperview];
// self.navigationItem.title = @"Contents";
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setSubject:@""];
[mailViewController setMessageBody:@"" isHTML:NO];
NSString *string = [NSString stringWithFormat:@"", nil];
NSArray *mailArr = [[NSArray alloc] initWithObjects:string,nil];
[mailViewController setToRecipients:mailArr];
[self presentModalViewController:mailViewController animated:YES];
[mailViewController release];
}
else {
NSLog(@"Device is unable to send email in its current state");
}
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error;
{
NSLog(@"Mail");
NSString *str=@"";
switch (result) {
case MFMailComposeResultCancelled:
NSLog(@"Mail send canceled.");
str=@"
Mail sending cancelled";
//msgLabel.text=str;
// [msgLabel setFont:[UIFont fontWithName:@"Arial" size:18]];
// msgLabel.textColor=[UIColor colorWithRed:(54.0/255.0) green:(2.0/255) blue:(1.0/255) alpha:1.0];
/*
Execute your code for canceled event here ...
*/
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved.");
str=@"Mail saved";
/*
Execute your code for email saved event here ...
*/
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent.");
str=@"Mail sent";
/*
Execute your code for email sent event here ...
*/
break;
case MFMailComposeResultFailed:
str=@"Mail not sent";
NSLog(@"Mail send error: %@.", [error localizedDescription]);
/*
Execute your code for email send failed event here ...
*/
break;
default:
break;
}
//alertLabel.text=str;
// [viewAlert setBackgroundColor:[UIColor clearColor]];
// [self.view addSubview:viewAlert];
[self dismissModalViewControllerAnimated:YES];
}