2011-07-29 7 views
0

私はiPhoneのアプリケーションを作成し、私は日本語のメールを送信する必要があります。 私はskpsmtpmessageを使用します。 しかし、そのアプリケーションが送信するメールは文字化けしたメールです。skpsmtpmessageを使って日本のメールを送ることはできますか?

日本のメールの送信方法を教えてください。

+0

を試すことができますか? – Pripyat

+0

確実にエンコードします。あなたがまだいない場合は、UTF-8を使用する必要があります!私は[PostageApp](http://postageapp.com)で日本の顧客を持っていると確信しています。そのため、送信時にUTF-8をサポートする必要があり、うまく表示されます。 – JonLim

答えて

0

あなたのnsstringエンコーディングは何ですか?

SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init]; 
    testMsg.fromEmail = @"[email protected]"; 
    testMsg.toEmail [email protected]"[email protected]"; 
    testMsg.relayHost = @"smtp.gmail.com"; 
    testMsg.requiresAuth = YES; 
    testMsg.login = @"[email protected]"; 
    testMsg.pass = @"test"; 
    testMsg.subject = [NSString stringWithCString:"测试" encoding:NSUTF8StringEncoding]; 
    testMsg.bccEmail = @"[email protected]"; 
    testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS! 

    // Only do this for self-signed certs! 
    // testMsg.validateSSLChain = NO; 
    testMsg.delegate = self; 

    NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey, 
           [NSString stringWithCString:"测试正文" encoding:NSUTF8StringEncoding],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]; 

enum { 
    NSASCIIStringEncoding = 1, 
    NSNEXTSTEPStringEncoding = 2, 
    NSJapaneseEUCStringEncoding = 3, 
    NSUTF8StringEncoding = 4, 
    NSISOLatin1StringEncoding = 5, 
    NSSymbolStringEncoding = 6, 
    NSNonLossyASCIIStringEncoding = 7, 
    NSShiftJISStringEncoding = 8, 
    NSISOLatin2StringEncoding = 9, 
    NSUnicodeStringEncoding = 10, 
    NSWindowsCP1251StringEncoding = 11, 
    NSWindowsCP1252StringEncoding = 12, 
    NSWindowsCP1253StringEncoding = 13, 
    NSWindowsCP1254StringEncoding = 14, 
    NSWindowsCP1250StringEncoding = 15, 
    NSISO2022JPStringEncoding = 21, 
    NSMacOSRomanStringEncoding = 30, 
    NSUTF16StringEncoding = NSUnicodeStringEncoding, 
    NSUTF16BigEndianStringEncoding = 0x90000100, 
    NSUTF16LittleEndianStringEncoding = 0x94000100, 
    NSUTF32StringEncoding = 0x8c000100, 
    NSUTF32BigEndianStringEncoding = 0x98000100, 
    NSUTF32LittleEndianStringEncoding = 0x9c000100, 
    NSProprietaryStringEncoding = 65536 
}; 

たぶん、あなたはエンコーディングを確認しましNSISO2022JPStringEncoding

関連する問題