AFNowrking이 최선의 방법이라고 생각했지만 MFMailComposeViewController를 사용하지 않고 전자 메일을 보내려고했습니다. Web 프로그래밍에 익숙하지 않습니다. AFHTTPClient 클래스를 사용하여AFNetworking을 사용하여 웹 서버에서 전자 메일 보내기
임은, 여기에 내가 무슨 짓을했는지 : 사전에
-(IBAction)sendMail
{
NSURL *url = [NSURL URLWithString:@"http://flameapp.net"];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
txtName, @"si_contact_name1",
txtSubject, @"si_contact_subject1",
txtEmail, @"si_contact_email1",
txtMessage, @"si_contact_message1"
,nil];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"/?page_id=26" parameters:params];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:
[NSURL URLWithString:@"http://flameapp.net/?page_id=26"]];
NSURLResponse *response = [[NSURLResponse alloc] init];
[client postPath:@"/?page_id=26" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *text = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSLog(@"Response: %@", text);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@", [error localizedDescription]);
}];
}
감사합니다.
을 완료. 그것에 대해 나를 깨워 주셔서 감사합니다. – Xtrician