Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send E-mail in HTML format

I want to send an email in HTML format like as below image. How can I do this? Please help me. Thanks in advance...!

One

like image 538
Niranj Patel Avatar asked Jan 21 '23 10:01

Niranj Patel


2 Answers

String body = new String("<html><body><table><tr><td><br/>" +header+"</td></tr><br/><br/>"+"Get <b> Best Score </b> in your Android Phone.<br/>"+"<a href=\"" + link_val + "\">" + text_value+ "</a>");

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, html.fromHtml(body));

Android support only some Tag..

For more information check below link..

Link1

Link2

like image 100
Niranj Patel Avatar answered Jan 22 '23 23:01

Niranj Patel


Use any html editor program to design the html page. emailText contains the html data. I think this code is fairly obvious.

 final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
        emailIntent.setType("text/html");
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, 
            emailTo);
        emailIntent.putExtra(android.content.Intent.EXTRA_CC, 
                emailCc);
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, 
                subject);
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, 
                emailText);

   this.startActivity(Intent.createChooser(emailIntent, "Choose your email program"));
like image 21
Reno Avatar answered Jan 23 '23 00:01

Reno