[android-developers] Re: Sending HTML email with GMail installed on G1
Hello, everyone, I'm too getting unescaped version of the HTML in section with MIME "text/plain" and escaped version in section with MIME "text/html". I suppose that's because the EditText of the Mail/GMail app is populated with the passed HTML and on "Send", it changes the text data, so that it's valid, according to its inner inputType. Any new solutions or workarounds to this problem? Thanks, Dimitar On Nov 12 2008, 7:11 am, thrusty wrote: > Hello, > > I'm trying to sendHTMLemailusing the GMail package installed on the > T-Mobile G1. What I'm finding is that regardless of the content-type > I specify, the message body is always translated into both text/plain > and text/html; however, thehtmlis escaped (e.g. "<" becomes "<") > so it does not display ashtmlin the receivingemailclient. > > Here's how I'm setting up the Intent: > > String[] addresses = {aAddress}; > > Intent intent = new Intent(Intent.ACTION_SEND); > intent.putExtra(Intent.EXTRA_EMAIL, addresses); > intent.putExtra(Intent.EXTRA_SUBJECT, aSubject); > intent.putExtra(Intent.EXTRA_TEXT, aBody); > intent.setType("text/html"); > startActivity(newIntent); > > TheemailI receive looks something like this: > > MIME-Version: 1.0 > Content-Type: multipart/alternative; > boundary="=_Part_494_24247511.1226466478922" > > --=_Part_494_24247511.1226466478922 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > Here's a property you might want to look at:149 > Ashbury, > San Francisco, CA, 94117View in Puluwai | href="http://www.agencylogic.com/googlebase/149Ashbury-com > ">Browser > > --=_Part_494_24247511.1226466478922 > Content-Type: text/html; charset=UTF-8 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > >Here's a property you might want to look > at:
> > --=_Part_494_24247511.1226466478922-- > As you can see, thehtmlis modified by gmail. The "text/plain" > version is basically correct except for its mime type. > > I've tried setting various other content types, e.g.: > > "text/xhtml" > "message/rfc822" > "message/rfc2822" > "text/plain" > "multipart/mixed" > > No luck so far-- anyone have any ideas? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
- 149 Ashbury, San Francisco, CA, 94117
>View in Puluwai | http://www.agencylogic.com/googlebase/149Ashbury-com">Browser
[android-developers] Re: Sending HTML email with GMail installed on G1
Hello Thrusty, This can be solved by using Spans. Here is a piece of code which demonstrates how it can be done: SpannableString ss = new SpannableString(getResources ().getString(R.string.link)); ss.setSpan(new URLSpan(getResources().getString (R.string.url)), 0, ss.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); SpannableStringBuilder ssb = new SpannableStringBuilder (getResources().getString(R.string.mail_text)) .append(' ') .append(ss); Intent i = new Intent(Intent.ACTION_SEND) .putExtra(Intent.EXTRA_TEXT, ssb) .putExtra(Intent.EXTRA_SUBJECT, getString(R.string.mail_subject)) .setType("message/rfc822"); //$NON-NLS-1$ startActivity(Intent.createChooser(i, "Title:")); //$NON-NLS-1$ What this code does is is sending email composed of . Upon clicking on the link, the mail recipient will be navigated to a site, which address is specified by . Sergey On Nov 11 2008, 9:11 pm, thrusty wrote: > Hello, > > I'm trying to send HTML email using the GMail package installed on the > T-Mobile G1. What I'm finding is that regardless of the content-type > I specify, the message body is always translated into both text/plain > and text/html ; however, the html is escaped (e.g. "<" becomes "<") > so it does not display as html in the receiving email client. > > Here's how I'm setting up the Intent: > > String[] addresses = {aAddress}; > > Intent intent = new Intent(Intent.ACTION_SEND); > intent.putExtra(Intent.EXTRA_EMAIL, addresses); > intent.putExtra(Intent.EXTRA_SUBJECT, aSubject); > intent.putExtra(Intent.EXTRA_TEXT, aBody); > intent.setType("text/html"); > startActivity(newIntent); > > The email I receive looks something like this: > > MIME-Version: 1.0 > Content-Type: multipart/alternative; > boundary="=_Part_494_24247511.1226466478922" > > --=_Part_494_24247511.1226466478922 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > Here's a property you might want to look at:149 > Ashbury, > San Francisco, CA, 94117View in Puluwai | href="http://www.agencylogic.com/googlebase/149Ashbury-com > ">Browser > > --=_Part_494_24247511.1226466478922 > Content-Type: text/html; charset=UTF-8 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > >Here's a property you might want to look > at:
> > --=_Part_494_24247511.1226466478922-- > As you can see, the html is modified by gmail. The "text/plain" > version is basically correct except for its mime type. > > I've tried setting various other content types, e.g.: > > "text/xhtml" > "message/rfc822" > "message/rfc2822" > "text/plain" > "multipart/mixed" > > No luck so far-- anyone have any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
- 149 Ashbury, San Francisco, CA, 94117
>View in Puluwai | http://www.agencylogic.com/googlebase/149Ashbury-com">Browser
[android-developers] Re: Sending HTML email with GMail installed on G1
a question about URLSpan : Is there a way to have a link with a different label than the URL itsself? I want something analog to: {a href='http://www.google.com'}Google{/a} instead of {a href='http://www.google.com'}http://www.google.com{/a} On Jan 2, 1:57 pm, sergey wrote: > Hello Thrusty, > > This can be solved by using Spans. Here is a piece of code which > demonstrates how it can be done: > > SpannableString ss = new > SpannableString(getResources > ().getString(R.string.link)); > ss.setSpan(new > URLSpan(getResources().getString > (R.string.url)), 0, ss.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); > SpannableStringBuilder ssb = > new SpannableStringBuilder > (getResources().getString(R.string.mail_text)) > .append(' ') > .append(ss); > Intent i = new > Intent(Intent.ACTION_SEND) > > .putExtra(Intent.EXTRA_TEXT, ssb) > > .putExtra(Intent.EXTRA_SUBJECT, > > getString(R.string.mail_subject)) > > .setType("message/rfc822"); //$NON-NLS-1$ > > startActivity(Intent.createChooser(i, "Title:")); //$NON-NLS-1$ > > What this code does is is sending email composed of > > > . > > Upon clicking on the link, the mail recipient will be navigated to a > site, which address is specified by . > > Sergey > > On Nov 11 2008, 9:11 pm, thrusty wrote: > > > Hello, > > > I'm trying to send HTML email using the GMail package installed on the > > T-Mobile G1. What I'm finding is that regardless of the content-type > > I specify, the message body is always translated into both text/plain > > and text/html ; however, the html is escaped (e.g. "<" becomes "<") > > so it does not display as html in the receiving email client. > > > Here's how I'm setting up the Intent: > > > String[] addresses = {aAddress}; > > > Intent intent = new Intent(Intent.ACTION_SEND); > > intent.putExtra(Intent.EXTRA_EMAIL, addresses); > > intent.putExtra(Intent.EXTRA_SUBJECT, aSubject); > > intent.putExtra(Intent.EXTRA_TEXT, aBody); > > intent.setType("text/html"); > > startActivity(newIntent); > > > The email I receive looks something like this: > > > MIME-Version: 1.0 > > Content-Type: multipart/alternative; > > boundary="=_Part_494_24247511.1226466478922" > > > --=_Part_494_24247511.1226466478922 > > Content-Type: text/plain; charset=UTF-8 > > Content-Transfer-Encoding: 7bit > > Content-Disposition: inline > > > Here's a property you might want to look at:149 > > Ashbury, > > San Francisco, CA, 94117View in Puluwai | > href="http://www.agencylogic.com/googlebase/149Ashbury-com > > ">Browser > > > --=_Part_494_24247511.1226466478922 > > Content-Type: text/html; charset=UTF-8 > > Content-Transfer-Encoding: 7bit > > Content-Disposition: inline > > >Here's a property you might want to look > > at:
> > > --=_Part_494_24247511.1226466478922-- > > As you can see, the html is modified by gmail. The "text/plain" > > version is basically correct except for its mime type. > > > I've tried setting various other content types, e.g.: > > > "text/xhtml" > > "message/rfc822" > > "message/rfc2822" > > "text/plain" > > "multipart/mixed" > > > No luck so far-- anyone have any ideas? > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
- 149 Ashbury, San Francisco, CA, 94117
> >View in Puluwai | http://www.agencylogic.com/googlebase/149Ashbury-com">Browser
[android-developers] Re: Sending HTML email with GMail installed on G1
Guys, just use* Html.fromHtml()* method like the following: intent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(aBody)); Believe, this will help -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en