int count=1;
msg = "No. Desc. Code Size Cost Qty Amount";
for(Products p:list){
msg += count+" "+p.desc+" "+p.code+" "+p.size+" "+p.cost+" "+p.qnty+" "+p.amnt;
count ++;
}
try {
Message msg = new MimeMessage(ses);
msg.setFrom(new InternetAddress("samashanayananthi@gmail.com"));//from mail address
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("samasha.2017323@iit.ac.lk"));//to mail address
msg.setSubject("Tax Invoice");//set the mail subject
msg.setContent("<h:body style=background-color:white;font-family:verdana;>"+"<h1 style=\"padding-left:500px\"><b>Jeff's Fishing Shack</b></h1>"
+"<h2 style=\"padding-left:570px\"><b>Tax Invoice</b></h2>"+"<p style=\"padding-left:80px\">Jeff’s Fishing Shack<br>Trading as: Octopus Pty Ltd<br>Shop 4, Hillarys Boat Harbour<br>Hillarys, WA, 6025<br>T: 08 9402 2222<br>Email:\tSales@JFS.com.au</p>\n"
+ "<p style=\"padding-left:80px\">Reciepts#: </p> <p style=\"padding-left:1000px\">Date :</p>\n"+"<p style=\"padding-left:80px\">Customer :</p>\n"+"<p style=\"padding-left:80px\">Customer# :</p>\n"
+"<p style=\"padding-left:80px\">Customer email :</p>\n"+"<p style=\"padding-left:80px\">Purchases</p>\n"
+"<div style=\"padding-left:80px; padding-right:80px\">"+msg+"</div>\n"+"<p style=\"padding-left:800px\">Total paid : </p>\n"
+"<p style=\"padding-left:700px\">Thank you for your business.<br>Jeff’s - where the real fishermen shop.</p>\n"
+ "</body>", "text/html; charset=utf-8");
When I send the message, I'm receiving the message correctly. But in my code I added a msg
variable and I tried to add it to the mail body.
My msg
variable is not displaying in the mail. I'm getting a message saying,javax.mail.internet.MimeMessage@772ef644
.
How can I fix it and what did I do wrong?