0

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의 추가 화면없이 이메일을 보낼 수 있습니다?

미리 감사드립니다.

+0

이것 없이는 불가능하다고 생각합니다. – Vishal

답변

1

를 호출 할 수 있습니다. 이메일 본문과 수신자의 이메일 주소, 제목 등을 매개 변수로 사용하여 백엔드에서 메일을 보내는 웹 서비스를 작성하십시오.

1

당신은 PHP script to send email을 만들 수 있으며, 당신은 웹 서비스에 의해 그것을 할 수 있습니다하려면, 메시지, 주제 장치에서 전달과 PHP는 서비스 호출,

1

사용자 상호 작용없이 이메일을 보낼 수있는 API는 Apple에서 제공하지 않습니다.

관련 문제