I'm new in programming. How am I going to send A verification link in email?
I managed to send Email but not A verification code, that a user must click in order to complete the registration. thanks in advance.
Here is the code in sending mail.
public static void send() {
String to = "rchiluano@partnersolutions.com.ph";//change accordingly
String from = "hryanmark@gmail.com";//change accordingly
String host = "localhost";//or IP address
//Get the session object
Properties properties = System.getProperties();
properties.setProperty("mail.smtp.host", host);
Session session = Session.getDefaultInstance(properties);
//compose the message
try{
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
message.setSubject("Verify your Account");
message.setText("\tWe receive your request for registration. \n \n
\tPlease click the Link below to complete the registration\n" +
"");
// Send message
Transport.send(message);
System.out.println("Sent");
}catch (MessagingException mex) {mex.printStackTrace();}
}