The Javamail API
vou’ve now reached a point where you have to take a short detour. For your next step, you need something through which you FouOG sHnG Dn HPDLO Wo WhH :Dy2606 ,D usLnJ -DYD. YHs, the JavaMail API, the fourth and last ingredient. rsing this API, you can write programs to send, receive and manage HPDLOs YHUy HIfiFLHnWOy Ln -DYD. ThH GHYHOopHUs oI WhLs A3, have designed it so beautifully that application developers only have to write a few lines of code to get it running. It’s absolutely free to download from http://goo.gl/C38nv and is under active development. Download version 1.4.5, which is the latest at the time of writing this article. Follow these simple steps to integrate it with your Two Step Ver project: 1. (xWUDFW WhH zLp fiOH Wo WhH pUoMHFW IoOGHU ( TSV in this case). 2. 6wLWFh Wo WhH 1HWBHDns wLnGow DnG ULJhW-FOLFN Two Step
Ver in the Projects panel and choose the Properties option. 3. In the Project Properties window, select Libraries under
Categories and click Add JAR/Folder 4. In the Add JAR/Folder window, navigate to the JavaMail
API folder, select mail.jar and click Open. 5. COLFN OK in the Project Properties window, and that’s LW—you’UH GonH. 5HWuUnLnJ Wo WhH FoGH—you nHHG Wo DGG FoGH Wo sHnG the randomly generated code to the registered cell phone nuPbHU WhUouJh 606. )LUsW DGG WhHsH OLnHs DW WhH bHJLnnLnJ, as shown below:
package tsv; import javax.mail.*; import javax.mail.internet.*;
Now, replace /*<<To be continued….>>*/ with the following code: L*petting the mail server properties*L
java.util.mroperties props = new java.util. mroperties(); props.put(“mail.smtp.host”,”smtp.gmail.com”); props.put(“mail.smtp.socketcactory.port”, “4S5”); props.put(“mail.smtp.socketcactory.class”,”javax.net. ssl.ppipocketcactory”);