1

我想在邮件底部添加文本“Sent from”

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];
      }
4

2 回答 2

2

您可以将消息正文设置为isHTML:YES并使用换行符<br>或尝试\nsetMessageBody字符串中使用

然后在此之后添加您的“发送自”消息。

于 2010-07-28T19:25:24.707 回答
0

试试这个代码我已根据您的要求更改了代码

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];
      }

快乐的编码...

于 2010-08-24T10:31:35.470 回答