0
としてのiOSメールクライアントに表示されます。ホットメールやGmailのクライアントを介して私はjpeg画像を参照してください。しかし、iOSのメールクライアントからこの同じメールを見ると、添付ファイルが「連絡先」として表示され、これをクリックするとファイルを新しい連絡先として保存することができます。メールの添付ファイルは、私はこの便利なライブラリを使用して添付ファイルを送信するためのコードをテストしている接触
私はhotmailからjpeg添付ファイル付きの電子メールを送信しようとしました。これを行うと、iOSクライアントに正しく表示されます。
これがコードかiOSが間違っているかどうかは誰にも分かりますか?
//the guts of the message.
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 = @"password";
testMsg.subject = @"The message subject";
testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!
// Only do this for self-signed certs!
// testMsg.validateSSLChain = NO;
testMsg.delegate = self;
//email contents
NSDate* now = [NSDate date];
NSString * bodyMessage = [NSString stringWithFormat:@"The message body"];
// email image if it exists
NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/file.jpeg"];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSMutableArray* parts = [[NSMutableArray alloc] init];
// add plain part
NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,
bodyMessage ,kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
[parts addObject: plainPart];
// add attachments
NSData *attachmentData = [NSData dataWithContentsOfFile:jpgPath];
NSString *directory = @"text/directory;\r\n\tx-unix-mode=0644;\r\n\tname=\"file.jpeg\"";
NSString *attachment = @"attachment;\r\n\tfilename=\"file.jpeg\"";
NSDictionary *image_part = [NSDictionary dictionaryWithObjectsAndKeys:
directory,kSKPSMTPPartContentTypeKey,
attachment,kSKPSMTPPartContentDispositionKey,
[attachmentData encodeBase64ForData],kSKPSMTPPartMessageKey,
@"base64",kSKPSMTPPartContentTransferEncodingKey,nil];
[parts addObject: image_part];
testMsg.parts = parts;
[testMsg send];
この作品は?私は電子メールにjpegイメージを追加しようとしています。私にとってはうまくいかないようです。 –
私はバックグラウンドスレッドで電子メールを送信しようとしていました。私はプロキシサーバーを使ってメッセージを中継していました。 – Ellis