2012-02-15 22 views
0

Google smtpを使用してメールを送信しようとしています。私のコードと私のエラーがある画像を添付してください。 私のコード: - (IBAction)Gonderの:(ID)、送信者{Google SMTP(エラー)を使用してメールを送信する方法

SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init]; 
testMsg.fromEmail = @"[email protected]"; 
testMsg.toEmail = @"[email protected]"; 
testMsg.relayHost = @"smtp.gmail.com"; 
testMsg.requiresAuth = YES; 
testMsg.login = @"[email protected]"; 
testMsg.pass = @"mypass"; 
testMsg.subject = @"had"; 
//testMsg.bccEmail = @"[email protected]"; 
testMsg.wantsSecure = YES; 
testMsg.delegate = self; 

NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey, 
          @"FDDFAFAD",kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil]; 

NSString *vcfPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"vcf"]; 
NSData *vcfData = [NSData dataWithContentsOfFile:vcfPath]; 

NSDictionary *vcfPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/directory;\r\n\tx-unix-mode=0644;\r\n\tname=\"test.vcf\"",kSKPSMTPPartContentTypeKey, 
         @"attachment;\r\n\tfilename=\"test.vcf\"",kSKPSMTPPartContentDispositionKey,[vcfData encodeBase64ForData],kSKPSMTPPartMessageKey,@"base64",kSKPSMTPPartContentTransferEncodingKey,nil]; 

testMsg.parts = [NSArray arrayWithObjects:plainPart,vcfPart,nil]; 

[testMsg send]; 

と私の誤差が

My Error!!

'NSException'

のインスタンスを投げた後に呼び出さ終了することができます私を助けて?そして私はこのコードに画像を添付する必要があります。サンプルコードから

答えて

0

右:第しかしで

http://code.google.com/p/skpsmtpmessage/source/browse/trunk/SMTPSender/Classes/SMTPSenderAppDelegate.m

testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS! 
+0

おかげ。申し訳ありません私はtlsの意味を知っていません。私はイオスのためにとても新しいです。 – ali10

+0

TLS =トランスポート層のセキュリティ。私はあなたがtestMsg.wantsSecure = NOを望んでいると仮定しています。 – DJPlayer

+0

私はそれを試してもそれは解決しませんでした。私はSIGABRTエラーを取得しています – ali10

関連する問題