-2

我正在尝试发送一个包含图像和文本的 html 页面。问题是我发送时未显示该图像。有什么解决办法呢?提前谢谢..

我的代码是:

[picker addAttachmentData:myData mimeType:@"pdf" fileName:@"ShowerDoorsQuotation.pdf"];
NSString *emailBody = [NSString stringWithFormat:@"<html>
  <head>
  </head>
  <body><img  src='ShowerDoors/ShowerDoors/logo.png' width='150px' height='150px'/>
  </body>
  </html>"];

[picker setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:picker animated:YES];
[picker release];
4

3 回答 3

1

目前,您不能使用 MEMailComposer 发送本地图像。希望苹果以后能加入这个功能。

相反,您可以提供服务器上的图像链接。然后您将能够在邮件中看到图像。

或者正如 paulheyer 在他的回答中所写

您可以在 HTML 中包含内联图像,但您必须使用 base64 编码对附件数据进行编码。这会导致某些电子邮件客户端出现问题,例如 Gmail。请在此处找到有关此问题的详细讨论:How to add an UIImage in MailComposer Sheet of MFMailComposeViewController in iPhone

或者

如何在 MFMailComposeViewController for iPhone 的 html 中嵌入图像

于 2012-02-08T06:00:15.013 回答
1

我认为您将图像 URL 像这样src='ShowerDoors/ShowerDoors/logo.png' 更改为 FULL URL 之类的http://www.example.com/ShowerDoors/ShowerDoors/logo.png,它可能有效...

于 2012-02-08T06:20:48.967 回答
0

如果您确实需要在电子邮件中发送 html,则必须包含绝对网址,而不是相对网址。

于 2012-02-08T06:13:43.100 回答