私はこのトピックに慣れていないので、助けてください...
Skpsmtpmessage クラスを使用して、SMTP サーバーにユーザー情報を送信しています。しかし、「操作を完了できませんでした」というメッセージが表示されます。の-(void)messageFailed:(SKPSMTPMessage *)message error:(NSError *)error)
私を助けてください。
- (void) sendMessage {
SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
NSString *myString;
testMsg.relayHost = @"smtp.gmail.com";
testMsg.requiresAuth = YES;
testMsg.login = @"my gmail id";
testMsg.pass = @"my gmail password";
testMsg.subject = [NSString stringWithFormat:@"CLIENT iPhone App - %@", self.navigationItem.title];
testMsg.bccEmail = emailField.text;
testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!
testMsg.fromEmail = emailField.text;
NSString *ff = [[UIDevice currentDevice] uniqueIdentifier];
NSString *gg = [[UIDevice currentDevice] model];
NSString *hh = [[UIDevice currentDevice] localizedModel];
NSString *ii = [[UIDevice currentDevice] name];
NSString *jj = [[UIDevice currentDevice] systemName];
NSString *kk = [[UIDevice currentDevice] systemVersion];
NSString *path;
if ([self.navigationItem.title isEqualToString:@"Request Authorization"])
{
path = [[NSBundle mainBundle] pathForResource:@"ThankYou" ofType:@"txt"];
testMsg.toEmail = @"myname@gmail.com";
}
else
{
path = [[NSBundle mainBundle] pathForResource:@"ThankYou2" ofType:@"txt"];
testMsg.toEmail = @"myanme@gmail.com";
}
NSString *fileText = [NSString stringWithContentsOfFile:path];
myString = [NSString stringWithFormat:@"LEADERS %@-\n\n%@\n\nName: %@\nCompany: %@\nAddress: %@\nCity: %@\nState: %@\nZip: %@\nPhone: %@\nFax: %@\nEmail: %@\nComments: %@\nRequire New Merchant Account: %@\nReferral Code: %@\nIdentifier: %@\nModel: %@\nLocalized Model: %@\nName: %@\nSystem Name: %@\nSystem Version: %@",self.navigationItem.title,fileText, firstNameField.text,companyField.text,addressField.text,cityField.text,stateField.text,zipCodeField.text,phoneField.text,faxField.text,emailField.text,countryField.text,customerIdField.text,lastNameField.text,ff,gg,hh,ii,jj,kk];
NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,
myString,kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
testMsg.parts = [NSArray arrayWithObjects:plainPart,nil,nil];
testMsg.delegate= self;
[testMsg send];
[self.navigationController popViewControllerAnimated:TRUE];
}