MFMailComposeViewController를 표시하지 않고 이메일을 보내고 싶습니다. 난 그냥 전자 메일의 일부 순서로 전자 메일을 보내려고 (그래서 사용자가 내 회 전자를 볼 수 있어야합니다, MFMailComposeViewController가 아니라 보내기 버튼과 함께).이메일 문제 : 추가 창없이 이메일을 보내고 싶습니다.
내가 아는 이메일을 보낼 수있는 유일한 방법은 다음과 같습니다 (하지만 내가 원하는 아니에요)
-(void)showMessageController:(id)sender
{
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
// We must always check whether the current device is configured for sending emails
if ([mailClass canSendMail])
{
[self displayComposerSheet];
}
else
{
[self launchMailAppOnDevice];
}
}
else
{
[self launchMailAppOnDevice];
}
}
// Displays an email composition interface inside the application. Populates all the Mail fields.
-(void)displayComposerSheet
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
[appDelegate setNavigationBarTextured:YES navigationBar:picker.navigationBar];
picker.mailComposeDelegate = self;
[picker setSubject:@"Please, look at my photo!"];
// Attach an image to the email (mydata - data of the image)
[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"photo"];
// Fill out the email body text
NSString *emailBody = @"Hello!\nPlease, have a look at my photo!";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];
}
// Launches the Mail application on the device.
-(void)launchMailAppOnDevice
{
// NSString *recipients = @"mailto:[email protected][email protected],[email protected]&subject=Hello from California!";
NSString *recipients = @"mailto:subject=Please, look at my photo!";
NSString *body = @"&body=Hello!\nPlease, have a look at my photo!";
NSString *email = [NSString stringWithFormat:@"%@%@", recipients, body];
email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}
가 어떻게 MFMailComposeViewController의 추가 화면없이 이메일을 보낼 수 있습니다?
미리 감사드립니다.
이것 없이는 불가능하다고 생각합니다. – Vishal