我正在使用SkpsmtpMessage庫進入我的項目,一切正常。 問題是與電子郵件正文的佈局。我想表明它在很好的佈局如粗體名稱,然後希望嵌入圖像到它,這樣它會顯示在客戶端打開電子郵件等等等等 現在我只是用使用SkpsmtpMessage庫格式的電子郵件正文
NSString * bodyMessage = [NSString stringWithFormat:@"Dear %@:\n \nThank you for reserving your holiday with us. Your order is now confirmed -
see below your details including your order reference number and your chosen collection point. ",%@];
它只是演示。 那麼我怎麼能正確地格式化它,就像我們在其他電子郵件客戶端中那樣。
預先感謝您。
SOLUTION:
使用
NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/html",kSKPSMTPPartContentTypeKey,
body ,kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
即文本/ HTML而不是text/plain的。
代碼
SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/html",kSKPSMTPPartContentTypeKey,
body ,kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
testMsg.parts = [NSArray arrayWithObjects:plainPart,nil];
[testMsg send];
這裏身體的NSString包含HTML文本...
謝謝。希望任何人都可以使用它。
非常感謝...我正要浪費我的時間..... – 2013-11-20 09:32:27