Android sending email with css html embedded

霸气de小男生 提交于 2019-12-24 17:54:56

问题


I am sending a mail using intent from android application but my css is not loading. can someone help me load the css please. where am i wrong. Am stuck on this silly option for hours nows.

here part of my div.

<div style="background:"+String.format(hex,colors.get(position).hex)"></div>...


回答1:


I had the same problem, and couldnt fix it. I don't think its possible to send css with the default email clients (correct me if i'm wrong).

My work around was sending the html as a attachment.

see: Is it possible to send html with the mail intent?

Edit: here is example how i did it:

  • save the html as a file..
  • add you attachments to a list of Uri objects
  • see following code how to create a mail intent with the attachements..

    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
        emailIntent.setType("text/html");
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "title");
    
        emailIntent.putExtra(Intent.EXTRA_TEXT, "email body text");
        emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        startActivity(Intent.createChooser(emailIntent, "Email:")); 
    


来源:https://stackoverflow.com/questions/13644486/android-sending-email-with-css-html-embedded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!