i want to send email using html code. plzz help
GMailSender m = new GMailSender("", "");
String[] toArr = {""};
m.setTo(toArr); // load array to setTo function
m.setFrom("dawinderg@gmail.com"); // who is sending the email
m.setSubject("Registration");
m.setBody("Thanks for registration with us.");
i want to send
You can use this:
m.setBody(Html.fromHtml("<h1>Title</h1><br>Username "+ username +" and password"));
You can also create html tables or any other html elements
If the example is from here: GMailSender example
Change
DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain"));
with DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/html"));
and add the body like this:
m.setBody("<html><h1>TESTING<h1></html>");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.