0

In my application i am sending email to the new user , I want to send a button as well in the email , on when user click .he will be redirected to my website..

I have this right now

message.setSubject("TIE Account Created");
message.setText("Dear " + user.getFirstName() +" "+ user.getLastName()+" "
    + "\n\n  Your  Account created,"
    + "\n\n Please activate your account" 
    + " <a href=www.example.eu:8080/Project/#!"+ user.getToken()+" >"
    +" <button>Activate your Account</button> </a>"
    );
Transport.send(message);

Now what I am getting in email is the same code and no button, like this :

Dear user
Your Account created,
Please activate your account <a href=www.example.eu:8080/Project/#!d11qddnobot2665mjl20va87qh > <button>Activate your Account</button> </a>
Nailgun
  • 3,999
  • 4
  • 31
  • 46
junaidp
  • 10,801
  • 29
  • 89
  • 137

1 Answers1

3

Most of email clients will likely discard the button tags in your email. So just use the well-styled "a" element. Here is an article with a good example.

Update:

Also it seems that you're sending email with plain text instead of html content. Please google for how to send html email with javamail API. Here is a nice example.

Nailgun
  • 3,999
  • 4
  • 31
  • 46