我使用這個link我的代碼在電子郵件正文部分文本發送圖像下面如何在電子郵件正文中發送圖片?
NSString *urlString = @"url";
NSString *searchingurl = [NSString stringWithFormat:@"%@%@", urlString,idnumber];
NSString *string = [NSString stringWithFormat:@"%@<br><br>Item No :%@<br>Type :%@<br>Size : %@",searchingurl,str123,mytype,itemsize];
NSMutableString *emailBody = [[[NSMutableString alloc] initWithString:@"<html><body>"] retain];
NSData *imageData = UIImageJPEGRepresentation(myImage, 1.0f);
NSString *encodedString = [imageData base64Encoding];
[emailBody appendString:[NSString stringWithFormat:@"<p><b><img src='data:image/png;base64,%@'></b></p>",encodedString]];
[emailBody appendString:string];
[emailBody appendString:@"</body></html>"];
NSLog(@"%@",emailBody);
MFMailComposeViewController *emailDialog = [[MFMailComposeViewController alloc] init];
emailDialog.mailComposeDelegate = self;
[emailDialog setSubject:@""];
[emailDialog setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:emailDialog animated:YES];
[emailDialog release];
[emailBody release];
Screenshow給出了上面的代碼
發送郵件到雅虎它顯示我的映像後,在Mackbook和iPhone設備上的文本,當我發送郵件到Gmail並在iphone設備中檢查它顯示圖像的文本,但當我在Mackbook中檢查Gmail時它不顯示我的圖像
有人可以指導我,爲什麼我的形象不是顯示在Gmail上PC.Any幫助將appriated.Thanks
可能重複:// stackoverflow.com/questions/12210571/how-to-add-a-image-in-email-body-using-mfmailcomposeviewcontroller) – danh 2013-02-13 17:50:10
@danh但我有不同的情況下你的鏈接顯示文字之前的圖像,但我希望在電子郵件中的文字之前的圖像。 – jamil 2013-02-13 17:54:28
你不能只交換你添加的順序,並添加文本與MIME類型的應用程序/文本 – danh 2013-02-13 18:03:43