Results 1 to 6 of 6
  1. #1
    yalgashev is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

    Unhappy Generating activation code

    Hi, dear friends!!! I'm new in java
    I'm realizing new Certificate Authorization.
    Now I'm in activation code step.
    I've a problem with realizing activation code.
    As I understand, activation code works like this:
    1) I get a id+users e-mail, and got a digest with MD5 or SHA1
    2) I save the digest to base and send it to user
    3) User gets a digest and resends it to me
    4) I check: if my digest and digest, which user send are equal, then I believe that, there are such as e-mail, and I send some another information via user's e-mail.

    Friend, firstly, sorry for my poor English.
    Second, please let me now, am I understand validating e-mail right? If there are something wrong, please advice me.

    Thank for attention and advices! :)

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    618
    Rep Power
    4

    Default

    Hi
    I think that is correct actions. But this is not Java. This is just design app.

  3. #3
    yalgashev is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

    Default

    Yes, it's not java. I'm realizing all my application in java, that's why I thought may be java developers will help.
    Now, I've a such as question: how do I send messages to some e-mail via java application? Is there any solution? Thanks. :)

  4. #4
    yalgashev is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

  5. #5
    yalgashev is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

    Default

    Guys, I found solution! I didn't it myself: JavaMail API Sending email via Gmail SMTP example
    I choose second, works! :)
    Here is my code:
    Java Code:
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
     
    public class msgsendsample
    {
        public static void main( String[] args )
        {	
        	Properties props = new Properties();
        	props.put("mail.smtp.host", "smtp.gmail.com");
        	props.put("mail.smtp.socketFactory.port", "465");
    	props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
        	props.put("mail.smtp.auth", "true");
    	props.put("mail.smtp.port", "465");
     
    	Session session = Session.getDefaultInstance(props,
    	new javax.mail.Authenticator() 
    	{
    		protected PasswordAuthentication getPasswordAuthentication()
    		{ return new PasswordAuthentication(username, password);	}
    	});		
     
        	try {
     
                Message message = new MimeMessage(session);
    	    message.setFrom(new InternetAddress("username@gmail.com"));
    	    message.setRecipients(Message.RecipientType.TO, 
                            InternetAddress.parse("somebody@mail.org"));
    	    message.setSubject("Hi!");
    	    message.setText("This is me!");
     
    	    Transport.send(message);
     
    	    System.out.println("Done");
     
        	} catch (MessagingException e) {
        	    throw new RuntimeException(e);
        	}
        }
    }

  6. #6
    yalgashev is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 07-21-2012, 01:15 AM
  2. trying to bypass activation
    By saketh321 in forum New To Java
    Replies: 8
    Last Post: 08-21-2010, 09:57 PM
  3. Menu item activation in struts2+tiles project
    By aruna.hcu in forum Web Frameworks
    Replies: 0
    Last Post: 01-26-2010, 10:43 PM
  4. [SOLVED] Activation Frame
    By Mir in forum New To Java
    Replies: 34
    Last Post: 07-22-2008, 09:45 AM
  5. Replies: 1
    Last Post: 04-26-2007, 03:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •