【问题标题】:image does not show in the E-mail body图像未显示在电子邮件正文中
【发布时间】:2012-02-08 04:49:27
【问题描述】:

我正在尝试发送一个包含图像和文本的 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];

【问题讨论】:

  • 我们可以了解更多信息吗?
  • 在目前的邮件系统中,像gmail、yahoo这样的邮件服务商已经屏蔽了图片。图像将在单击显示图像时显示。你不能改变它。
  • 是的。但即使在模拟器中也没有显示图像。
  • 显示你正在实现的代码..
  • 谢谢。我减少了我的问题。现在给我答案。

标签: iphone html mfmailcomposer


【解决方案1】:

我想你把图片网址放在这样src='ShowerDoors/ShowerDoors/logo.png' 更改为http://www.example.com/ShowerDoors/ShowerDoors/logo.png 之类的完整URL,它可能有效...

【讨论】:

    【解决方案2】:

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

    相反,您可以提供服务器上的图像链接。然后你就可以在邮件中看到图片了。

    as paulheyer writes in his answer:

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

    或者

    How to embed image in html in MFMailComposeViewController for iPhone

    【讨论】:

    • 请勿在未提供适当出处的情况下剽窃他人答案中的语言。我已经编辑了您对 Paulheyer 的回答,因为您复制了他的话。
    【解决方案3】:

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

    【讨论】:

      猜你喜欢
      • 2019-12-14
      • 2019-12-12
      • 2011-10-17
      • 2013-05-27
      • 2011-09-06
      • 2016-08-02
      • 1970-01-01
      • 1970-01-01
      • 2014-07-29
      相关资源
      最近更新 更多