Send email with a custom html page - android

1

Good afternoon, Can someone help me, I'm developing an app, where after receiving some user data, an email containing this information is sent. I would like to use html to make the email presentable, put some background colors in the body of the email, change the color of the title, these things. I already searched but did not find, and what I found on the net did not work. Can someone give me strength with this?

String[] recipients = new String[]{endEmail, "",};

StringBuilder body = new StringBuilder();
body.append("<html><body><div bgcolor='#fcaf17' style='background:#fcaf17;font-family:arial,Verdana,sans-serif'>")
                                .append("<center><table cellpadding='30' cellspacing='0' border='0' bgcolor='#fcaf17' width='100%' style='width:100%;margin:0;padding:0;font-family:arial,Verdana,sans-serif'><tbody><tr>")
                                .append(" <td> <center><br><table cellpadding='10' cellspacing='0' border='0' bgcolor='#ffffff' width='640px' style='width:640px;background:#fff;font-family:arial,Verdana,sans-serif'>")

                                .append(" <tbody><tr> <td><table cellpadding='10' cellspacing='0' border='0' bgcolor='#ffffff' width='620px' style='width:620px;text-align:left;font-family:arial,Verdana,sans-serif'>")
                                .append(" <tbody><tr> <td><img src='link imagem' alt='logo_ncgames' class='CToWUd'>")
                                .append(" </td></tr></tbody></table> <hr style='border-top:#dfdfdf!important;border-right:none;border-left:none'>")
                                .append(" <h3 style='color:#ef871e'>Contato</h3> <p>Nome : <span style='font-size:18px;font-weight:bold'>bafae596</span></p>")
                                .append(" <p>Email : <span style='font-size:18px;font-weight:bold'>bafae596</span></p><p>Telefone : <span style='font-size:18px;font-weight:bold'>bafae596</span></p>")
                                .append(" <p>Descrição : <span style='font-size:18px;font-weight:bold'>bafae596</span></p> </td></tr></tbody></table><table cellpadding='10' cellspacing='0' border='0' bgcolor='#fef3da' width='640px' style='display:block;width:640px;height:40px;font-family:arial,Verdana,sans-serif'>")
                                .append(" <tbody><tr style='color:#1d284b;text-align:center'> <td><span style='color:#ef871e;font-size:10px'>OBS:Este email é enviado pelo sistema. Por favor não responda-o. Caso tenha dúvidas entre em contato.</span>")
                                .append(" </td></tr></tbody></table><br> <br></center></td> </tr></tbody></table></center></div></body></html>");

                        String stremail =  body.toString();

                        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
                        emailIntent.setType("text/html");
                        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, assunto);
                        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{to});
                        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(stremail));

                        startActivity(Intent.createChooser(emailIntent, "Enviar email...."));
    
asked by anonymous 19.10.2015 / 17:32

1 answer

0

I have already sent the normal html, as a String, the same as you.

In general email clients also ignore their meta tags, html, and leave only the content.

You have restricted space in the email client, so you set a fixed or self-adjusting width.

Desktop clients, some do not support CSS3, so take it easy.

Try some images, from external links, it may be a good choice!

    
20.10.2015 / 17:08