Reputation: 71
I want to send email to customer with shop name, shop address, shop contact number where shop contact contact number should be used like
<a href='tel:"+shopInfoForEmail.getContactNo()+"'>"+shopInfoForEmail.getContactNo()+"</a>"
but i could not set this info with html code. My email code is
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(barberConstants.systemEmail));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(userEmail));
message.setSubject("ご予約ありがとうございます。");
message.setText(userName+" 様," +
"\n\n この度は "+shopName+" をご利用くださり誠にありがとうございます。 "+booking+" にてご予約を受付いたしました。 \n\n"
+"店舗にてご予約を確認でき次第、改めて予約完了メールをお送りいたします。\n恐れ入りますが、いましばらくお待ちくださいますようお願いいたします。\n\n"+
"※まだご予約は確定しておりません。\n※こちらは自動配信メールのため、ご返信はできかねます。予めご了承ください。\n\n"+
"■店舗情報------------------------\n"+shopName+"\n"+**shopInfoForEmail.getContactNo()**+
"\n"+shopAddress+"\n"+shopInfoForEmail.getUrl()+"\n--------------------------------------");
Transport.send(message);
want to set href:tel in shopInfoForEmail.getContactNo(). Any help will be appreciated. Thanks in advance
Upvotes: 0
Views: 83
Reputation: 424
In order to use href:tel you should encode the url-telephone number.
You can use
String telephoneUrl=URLEncoder.encode("tel:"+shopInfoForEmail.getContactNo(), "UTF-8");
then use your encoded url to create html.
Upvotes: 0