2

我正在使用此链接在电子邮件正文中发送带有一些文本的图像,我的代码如下所示

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];

以上代码的屏幕显示

在此处输入图像描述

向雅虎发送邮件后,它会在 Mackbook 和 iPhone 设备上显示我的图像和文本,当我向 Gmail 发送邮件并在 iphone 设备中检查它时,它会显示带有文本的图像,但是当我在 Mackbook 中检查 gmail 时,它不会显示我的图像

有人可以指导我为什么我的图片没有显示在 PC 上的 Gmail 中。任何帮助都会得到帮助。谢谢

4

1 回答 1

-1
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@"Your subject"];


    // Set up recipients
    NSArray *toRecipients = [NSArray arrayWithObject:@""];
    //NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil];
    //NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"];

    [picker setToRecipients:toRecipients];
    //[picker setCcRecipients:ccRecipients];
    //[picker setBccRecipients:bccRecipients];


    NSLog(@"Video size >> %d",(videodta.length/1024)/1024);
  [picker addAttachmentData:imageData mimeType:@"image/png" fileName:@"testapp"];

    // Fill out the email body text
    NSString *emailBody = @"Type your message here";
    [picker setMessageBody:emailBody isHTML:NO];

    [self presentModalViewController:picker animated:YES];
    }
于 2013-02-13T17:39:56.043 回答