문제

In my app i am pre-filling the email address when the user wants to email someone. i do this like this:

NSArray *toRecipients = [NSArray arrayWithObject:@"sales@microsmith.com"];
NSString *subjectStr = [[NSString alloc] initWithFormat:@"test subject"];

MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setToRecipients:toRecipients];
[mailController setSubject:subjectStr];
[self presentModalViewController:mailController animated:YES];
[mailController release];

[subjectStr release];

this all works fine with no problems. However, i wanted to know if there was a way to change what showed in the "To:" field once the email opens.

For example, instead of showing - sales@microsmith.com, i would like it to show "Microsmith Sales".

Is that possible?

thanks in advance

도움이 되었습니까?

해결책

Yep, just change the way your recipient strings are formatted:

NSArray* recipients = [NSArray arrayWithObject: @"Sales Dept <sales@example.com>"];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top