Click Here |
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
.......................................................................
Libraries Download..
Click Here to download .jar files
................................................................................................
..............code start............................................
try {
String body=jTextArea1.getText();-- Body
String email=txtemail.getText();// -- To
// Using SSL
Properties propsSSL = new Properties();
propsSSL.put("mail.transport.protocol", "smtps");
propsSSL.put("mail.smtps.host", "smtp.gmail.com");
propsSSL.put("mail.smtps.auth", "true");
Session sessionSSL = Session.getInstance(propsSSL);
sessionSSL.setDebug(true);
Message messageSSL = new MimeMessage(sessionSSL);
messageSSL.setFrom(new InternetAddress("youremail@gmail.com", "janitha"));//your email messageSSL.setRecipients(Message.RecipientType.TO, InternetAddress.parse(email)); recipient
messageSSL.setSubject(txtsubject.getText());
messageSSL.setText(body);
Transport transportSSL = sessionSSL.getTransport();
transportSSL.connect("smtp.gmail.com", 465, "youremail@gmail.com", "password");
// youremail@gmail.com---set your email adress
//password ---- set email password
transportSSL.sendMessage(messageSSL, messageSSL.getAllRecipients());
transportSSL.close();
System.out.println("SSL done.");
System.out.println("------------------------------------Email Send------------------------------------");
} catch (Exception e) {
throw new RuntimeException(e);
}
Thankѕ for finaply talking about > "Java Email Code || using gmail || netbeans" < Loved it!
ReplyDeleteStop by my webpage Homes
just Liѕted
Hello tο ɑll, how is the whole thing, I think everү onе
ReplyDeleteis gettiոg more from this site, and үօur views arre pleasant for neew
ѵisitors.
Also visіt mmy wеb site :: luxury homes MN top realtors
What's Taking place i am nnew to this, I stumbled upon this I've discovered It absolutely helpful and it has helped me
ReplyDeleteout loads. I am hoping to contribute & assist different users like its aided me.
Good job.
Have a look at my homepage: luxury Homes mn
I am regular vіѕitor, how are ʏyou everybοdy? This paragгaph
ReplyDeleteposted at this website іs really fastidious.
Here iѕ my webpaɡe :: san diego homes
Hello very nice site!! Man .. Beautful .. Wonderful .. I'll bookmark your
ReplyDeleteblolg and take thee feeds also? I am happy to search out so many useful info
right here in the pput up, wwe waqnt develop more strategies on this regard, thank
you for sharing. . . . . .
Feel free to vissit my web-site downtown toronto condos real Estate listings
Wɦat'ѕ up, this weekend is good in favor of me, for the reason that this time
ReplyDeletei aam reading this impressive educatіonal post here at my house.
Stop Ƅʏ my site :: legacy luxury homes MN