views:

32

answers:

2

I would like to add the text "Sent from " to the bottom of the message

if([MFMailComposeViewController canSendMail]){
       MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
       controller.mailComposeDelegate = self;
       [controller setSubject:[NSString stringWithFormat:@"A message from: %@",self.profileName]];
       [controller setMessageBody:[NSString stringWithFormat:@"%@",self.cellBody] isHTML:NO];
       [self presentModalViewController:controller animated:YES];
       [controller release];
      }
      else {
       UIAlertView *alertView;
       alertView = [[UIAlertView alloc] initWithTitle:@"E-Mail Not Enabled" message:@"E-Mail is not supported on this device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
       [alertView show];
       [alertView release];
      }
A: 

You could set the message body as isHTML:YES and use line breaks <br> or try using \n in the setMessageBody string

Then just add your "sent from" message after that.

iWasRobbed
A: 

Try out this code I have changed the code as per your requirement

if([MFMailComposeViewController canSendMail]){
       MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
       controller.mailComposeDelegate = self;
       [controller setSubject:[NSString stringWithFormat:@"A message from: %@",self.profileName]];
       [controller setMessageBody:[NSString stringWithFormat:@"%@\nSent from : %@",self.cellBody,self.profileName] isHTML:NO];
       [self presentModalViewController:controller animated:YES];
       [controller release];
      }
      else {
       UIAlertView *alertView;
       alertView = [[UIAlertView alloc] initWithTitle:@"E-Mail Not Enabled" message:@"E-Mail is not supported on this device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
       [alertView show];
       [alertView release];
      }

Happy Coding...

Suriya