I am developing email application using java. I have a string as follows :
String msg= "College Email \nHello"+" "+name+"\n"+"You are selected As 'Admin'.\n Please use Given username and password for login\n \Username:"+" "+username+" "+"Password:"+" "+password+"";
I want send this string as email message. and i want to "BOLD and color" username and password(I want to show this message in inbox i.e on browser). how can i embed HTML tags to do this ? OR is there any simple way to do this without using HTML tags ?
Can any one correct above string (msg) OR provide any link or code to fix this problem ?
thank you.
Just type the tags into your message like String msg = "<strong>Hello World!</strong>
and send it as a HTML message, you only need to set type of the content via MimeMessage#setContent()
method like
message.setContent(msg, "text/html; charset=utf-8");`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With