简体   繁体   English

Android:如何使用带有自定义字体的 Outlook 使用 Intent 发送电子邮件

[英]Android: How to Send email using outlook with custom font using intent

I am developing android app in which i send email using intent when i send email using gmail it is working fine but when i choose outlook the body is empty.我正在开发 android 应用程序,当我使用 gmail 发送电子邮件时,我使用 Intent 发送电子邮件,它工作正常,但是当我选择 Outlook 时,正文为空。

Custom font is also not working.自定义字体也不起作用。

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, title);

Typeface face = Typeface.createFromAsset(getAssets(), "gotham_book.otf");
SpannableStringBuilder SS = new SpannableStringBuilder(new StringBuilder()
                .append("<p>Check out this RFP I found on MWBE Connect NY:</p><br/>")
                .append("<p><b>Title: </b>"+title+"</p>")
                .append("<b><p>Agency: </b>"+agency+"<p/>")
                .append("<b><p> Description: </b>" + longdesc + "</b><p/>")
                .append("<b><p> Published: </b>" + starteddate + "</b><p/>")
                .append("<b><p> Deadline: </b>" + deadline + "</b><p/>")
                .append("<b><p> More info: </b>" + agencyurl + "</b><p/>")
                .append("<p>© 2016 Capalino+Company, New York, NY.</p>")
                .append("<p>For more information on Capalino+Company’s MWBE services, including RFP response strategy and development, please email us at mwbeconnectny@capalino.com.</p>")
                .append("<a><p>http://www.capalino.com/</p></a>")
                .toString());

SS.setSpan(face, 0, SS.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(SS.toString()));

intent.setType("text/html");
intent.setType("message/rfc822");
startActivityForResult(Intent.createChooser(intent, "Send Email"), Constants.Content_email_Constants);

Web Fonts Do Not Work in Outlook or Gmail Web 字体在 Outlook 或 Gmail 中不起作用

Sadly for you, Gotham is not a web safe font and it's not free like a Google Font.可悲的是,Gotham 不是一种网络安全字体,也不像 Google 字体那样免费。 To use it in email, you need to pay typography.com for the rights to use it and to include a link to the stylesheet they host.要在电子邮件中使用它,您需要向typography.com 付费以获得使用它的权利并包含指向他们托管的样式表的链接。 Unless of course the email recipient has installed the font on their own computing device.当然,除非电子邮件收件人已在他们自己的计算设备上安装了该字体。

Even in that case, it doesn't work with Outlook or Gmail.即使在这种情况下,它也不适用于 Outlook 或 Gmail。 You need to choose a web safe alternative fallback like Arial or Trebuchet.您需要选择像 Arial 或 Trebuchet 这样的网络安全替代后备方案。

Embed a Font嵌入字体

You could embed a woff2 base64 encoded font, but it still doesn't work with Gmail or Outlook, it most likely would be blocked as an attachment by email clients until the recipient allowed it.您可以嵌入 woff2 base64 编码字体,但它仍然不适用于 Gmail 或 Outlook,它很可能会被电子邮件客户端作为附件阻止,直到收件人允许为止。 In reality, it would be easier to use a link to a web font for email clients that do support web fonts.实际上,对于支持 Web 字体的电子邮件客户端,使用指向 Web 字体的链接会更容易。

Good luck.祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM