Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

link in java

hi guys

I have a method to send a email which goes like this

public boolean sendEmail(String id){
String from = "blabla@bla.com";
String to = "blablabla@bla.com";
String subject = "You have a new message;
String text = " you have new message" +
      "Please log into the application and take a look."

I want the application to be a hyperlink which should point to +"http://localhost:9081/flexweb/login.jsp"  .

any idea how i can do that?

thanks.


            
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Such a url would only be of use to people receiving mail on the same machine as the one running a service on port 9081. Is that what you want?

Do you know which mail program are using your recipients?

I don't think you can do it for all possible email clients
which people use, but for some most popular you can do
something

In particular in Outlook which I use any strings like you showed
in the text of the message (maybe sperated by spaces from
other stuff will be shiown and will act as links)
Avatar of Jay Roy

ASKER

>>>Such a url would only be of use to people receiving mail on the same machine as the one running a service on port 9081. Is that what you want?

yep, already know that. Dont worry about the actual URL value. that is my dev box URL. When application goes to production the URL value will be the one which can be accessed from any system.

thx.
Avatar of Jay Roy

ASKER

for_yan, the email is using Outlook in my company.

thx
You just need to use an html-formatted mail with a link in it
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
We are using Outlook and I just put http://... in the body of the
email like that:

          String sep = System.getProperty("line.separator");
      body += sep;
            body += "http://myhost.mycompany.com:8100/myfolder/myFile.html" + sep;

I don't even specify html in the header. They are all clicking and are all happy
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

good one for_yan. works for me.

thx
Great!
By the way, I recently had a challenge very closely related to this question.

We have some home grown application called PBB or something, and I guess they have configured Internet explorer for users,
that when you place in the address line of IE something like
pbb:some_address
it opens some_address using this application. And now they also wanted to click on such pbb:... link inside the email.
But outlook does not want to recognize it the same way as it recognizes http://...

Well, eventually I figured out how to do it creating corresponding http://...  files
and using them for redirection to "pbb:..." - and writing different address into each
redirection file, and  then it worked, but for couple of days
I thought I'd not be able to resolve this, as I could not find how to configure outlook, so that it could
recognize pbb:... as a link in the same way as http:...


Avatar of Jay Roy

ASKER

thanks guys
any help with my next question would be greatly appreciated
https://www.experts-exchange.com/questions/26930631/reading-java-values-in-properties-file.html

thx.