我正在使用以下代碼發送郵件,但是當我點擊發送按鈕時,它會退出應用程序併發送郵件。 我不想出來我的應用程序。我想在我的應用程序中發送來自iPhone的郵件
-(IBAction) done:(id) sender
{
[self sendEmailTo: @"[email protected]" withSubject: @" Question"
withBody:[textbody text]];
}
- (void) sendEmailTo:(NSString *)to withSubject:(NSString *) subject withBody:(NSString *)body
{
NSString *mailString = [NSString stringWithFormat:@"mailto:?to=%@&subject=%@&body=%@",
[to stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[subject stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[body stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:mailString]];
}
can any one have the solution for this ?