0

Hi I am making an app in which I am sending an email to a specific address

This email is a html email with table and images and all...like this

Is I have tried to add Html.fromhtml() but it keeps saying type mismatch needed string found spanned....

If you need any of my code please comment

Please suggest any tutorial if you have in mind

EDIT I forgot to mention I am sending mail using javax.maillibrary I am not using Intents I tried to use Html.tohtml(Spanned text) its giving the message of type mismatch cant convert String to spannedtext

I have no idea whats happening

I am receiving the html data in my mail if i just go with it

UPDATE I am fetching the content from a string resource and this is what I am getting as result

$message = ' For Support enquiry@makeintern.comContact Form Enquiry ! Name: :'.$name.'Email: :'.$email.'Contact: :'.$mobile.'Message: :'.$message.'Date-Time: :'.$current_date.'

Thanks and Regards MakeIntern Team Account Manager - MakeIntern Cell www.makeintern.com enquiry@makeintern.com

If any query Please call us on : 011-45544188  www.makeintern.com | enquiry@makeintern.com 

from---

<string name="email">$message = \'&lt;center&gt;
   &lt;table width="100%" cellpadding="0" cellspacing="0"&gt;
   &lt;tr&gt;
  &lt;td align="center" bgcolor="#FFFFFF"&gt;
    &lt;table width="620px" cellpadding="0" cellspacing="0"&gt;
    &lt;tr&gt;
        &lt;td width="400px"  bgcolor="#000000"  style="color:#FFFFFF; text-

decoration:none; float:left;font-size:10px;margin: -18px 3px -1px 11px; font-weight:bold; padding:2px; text-decoration:none; padding-left:0px;"&gt;For Support &lt;span style="text-decoration:none; color:#FFFFFF;"&gt;enquiry@makeintern.com&lt;/span&gt;&lt;/td&gt;
&lt;td width="220px" bgcolor="#000000"&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr style="background-color:#737373;"&gt;
&lt;td width="290" align="left" valign="middle"&gt;&lt;a href="http://makeintern.com" target="_blank"&gt;&lt;img src="http://www.makeintern.com/images/makeintern.jpg" width="136" border="0" alt="MakeIntern" style="display:block; padding-left:0px;"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td width="290" align="right" style="text-align:right; font-family:Arial, Segoe UI,Helvetica Neue, Helvetica, sans-serif; font-size:18px; line-height:18px; color:#FFFFFF; font-weight:normal; padding-right:10px;"&gt;Contact Form Enquiry !&lt;br&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height="12px" colspan="2"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center" style="line-height:16px; font-family:arial; font-size:12px; color:#888888; text-align:left;"&gt;
&lt;table cellspacing="0" cellpadding="0"&gt;
&lt;tr&gt;
        &lt;td width="200px" style="font-weight:bold;"&gt;Name: &lt;/td&gt;
        &lt;td width="100px"&gt;:&lt;/td&gt;
        &lt;td&gt;\'.$name.\'&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
        &lt;td width="200px" style="font-weight:bold;"&gt;Email: &lt;/td&gt;
        &lt;td width="100px"&gt;:&lt;/td&gt;
        &lt;td&gt;\'.$email.\'&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
        &lt;td width="200px" style="font-weight:bold;"&gt;Contact: &lt;/td&gt;
        &lt;td width="100px"&gt;:&lt;/td&gt;
        &lt;td&gt;\'.$mobile.\'&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
        &lt;td width="200px" style="font-weight:bold;"&gt;Message:  &lt;/td&gt;
        &lt;td width="100px"&gt;:&lt;/td&gt;
        &lt;td&gt;\'.$message.\'&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
        &lt;td width="200px" style="font-weight:bold;"&gt;Date-Time:  &lt;/td&gt;
        &lt;td width="100px"&gt;:&lt;/td&gt;
        &lt;td&gt;\'.$current_date.\'&lt;/td&gt;
        &lt;/tr&gt;


        &lt;/table&gt;

        &lt;br/&gt;&lt;br/&gt;

        Thanks and Regards &lt;br/&gt;
        MakeIntern Team &lt;br/&gt;
        Account Manager - MakeIntern Cell &lt;br/&gt;
        www.makeintern.com&lt;br/&gt;
        enquiry@makeintern.com&lt;br/&gt;&lt;br/&gt;
        &lt;b&gt;If any query Please call us on : 011-45544188&lt;/b&gt;&lt;br/&gt;
        &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
        &lt;td height="12px"&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
        &lt;td colspan="2"&gt;&lt;img src="http://www.myhotbooking.com/images/email-template/bar.png"&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
        &lt;td colspan="2" bgcolor="#737373" height="90px"&gt;
        &lt;table cellpadding="0" cellspacing="0" width="620px"&gt;
        &lt;tr&gt;
        &lt;td height="10px"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
        &lt;td align="center" style="color:#FFFFFF;" height="20px"&gt;&lt;a href="http://www.makeintern.com/"&gt;www.makeintern.com &lt;/a&gt;| &lt;span style="color:#FFFFFF; text-decoration:none;"&gt;enquiry@makeintern.com&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
        &lt;td align="center" valign="middle"&gt;
        &lt;a href="https://www.facebook.com/makeinterns" target="_blank"&gt;&lt;img src="http://www.myhotbooking.com/images/email-template/icon-facebook.png" width="26" height="26" border="0" alt="Facebook"&gt;&lt;/a&gt;&lt;a href="https://twitter.com/makeintern" target="_blank"&gt;&lt;img src="http://www.myhotbooking.com/images/email-template/icon-twitter.png" width="26" height="26" border="0" alt="Twitter"&gt;&lt;/a&gt;&lt;a href="https://www.linkedin.com/company/makeintern" target="_blank"&gt;&lt;img src="http://www.myhotbooking.com/images/email-template/icon-linkedin.png" width="26" height="26" border="0" alt="Linkedin"&gt;&lt;/a&gt;&lt;a href="https://plus.google.com/+makeintern" target="_blank"&gt;&lt;img src="http://www.myhotbooking.com/images/email-template/icon-google-plus.png" width="26" height="26" border="0" alt="Google+"&gt;&lt;/a&gt;&lt;/td&gt;


        &lt;/tr&gt;
        &lt;tr&gt;
        &lt;td align="center" style="color:#FFFFFF;"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;/table&gt;
        &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/table&gt;
        &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/table&gt;
        &lt;/center&gt;\'</string>

Thankyou in advance

Shubham
  • 72
  • 1
  • 10

1 Answers1

0

Try Below Code :

Intent sendIntent = new Intent();
 sendIntent.setAction(Intent.ACTION_SEND);
 sendIntent.putExtra(Intent.EXTRA_SUBJECT,getResources().getString(R.string.email_subject));
 sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(getResources().getString(R.string.email_text)));
 sendIntent.setType("text/plain");
 startActivity(Intent.createChooser(sendIntent, ""));

string.xml

<resources>    
    <string name="email_subject">Download App for your smartphone.</string>
    <string name="email_text"><![CDATA[Hey,<br/>I just downloaded App on my Android.<br/>It is a smartphone Manager.This app even lets me book parties,search restaurants.<br/>App is available for Android.<br/>
        Get it now from http://www.exampleapp.com/download]]></string>
</resources>