change how prefilled email address shows (XCode)
-
21-06-2021 - |
문제
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>"];
제휴하지 않습니다 StackOverflow