MFMailComposeViewController を使用せずに電子メールを送信しようとしましたが、いくつかの調査の後、AFNetowrking がそれを行うための最良の方法だと思いますが、それを理解して機能させることができず、Web プログラミングにあまり慣れていません。
私は AFHTTPClient クラスを使用しています。ここで私がやったこと:
-(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]);
}];
}
前もって感謝します。