• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Activating account via java mail

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm having some trouble trying to send an activation link using java mail in order for newly registered users to activate their account by clicking on the link in the email. How am I suppose to go about that? My concept is:
to generate a random id and this id is to be inserted into the db together with the information that a user entered in the registration form. then a comparison will be carry out to determine the right random_id and the id will be attached to the link. am i on the right track? by the way, when i include the random function (see below) my result for my random id is "java.util.Random@12r433" why will the java.util.Random@ appear?

my code for random function is:
Random rdn = new Random();
rdn.nextInt();

pls help. thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

You're probably doing something like rdn.toString(), but that returns a reference to the memory location where the object is stored - it has nothing to do with any random value. If you look at the javadocs for the RAndom class you'll see that a pseudorandom int (or long) can be gotten from the nextInt (or nextLong) method.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic