Results 1 to 6 of 6
Thread: Generating activation code
- 01-17-2011, 12:56 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
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! :)
- 01-17-2011, 01:55 PM #2
Hi
I think that is correct actions. But this is not Java. This is just design app.
- 01-18-2011, 03:53 AM #3
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
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. :)
- 01-18-2011, 03:59 AM #4
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
I googled and found this: Send email with JavaMail - Real's Java How-to and this: Sending Email From Your Application Using Java Mail
May be they'll help...
- 01-18-2011, 07:39 AM #5
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
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); } } }
- 01-18-2011, 07:40 AM #6
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
java.lang.NoClassDefFoundError: javax/activation/DataSource
By bbq in forum Advanced JavaReplies: 2Last Post: 07-21-2012, 01:15 AM -
trying to bypass activation
By saketh321 in forum New To JavaReplies: 8Last Post: 08-21-2010, 09:57 PM -
Menu item activation in struts2+tiles project
By aruna.hcu in forum Web FrameworksReplies: 0Last Post: 01-26-2010, 10:43 PM -
[SOLVED] Activation Frame
By Mir in forum New To JavaReplies: 34Last Post: 07-22-2008, 09:45 AM -
Generating Code Automatically Using Custom code Template In Eclipse
By JavaForums in forum EclipseReplies: 1Last Post: 04-26-2007, 03:52 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks