String host = “smtp.gmail.com”; String from = “username”; String pass = “password”; Properties props = System.getProperties(); props.put(“mail.smtp.starttls.enable”, “true”); // added this line props.put(“mail.smtp.host”, host); props.put(“mail.smtp.user”, from); props.put(“mail.smtp.password”, pass); props.put(“mail.smtp.port”, “587”); props.put(“mail.smtp.auth”, “true”); String[] to = {“to@gmail.com”}; // added this line Session session = Session.getDefaultInstance(props, null); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); InternetAddress[] toAddress = new InternetAddress[to.length]; // To get the array of addresses for( int i=0; iCode language: Java (java)
Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
hello
hay i am patel manoj
Hai hello
Can you give us the associated JARs or the complete import statements?
Please send the jar file to my mail too: embedzit@gmail.com
hey thanks for the Code dear.. its Totally workin nd onw thin is that I was lookin for this thisn since a long time but here i got the Perfect code that is Workin so that thanks a lot.. ! Take care Bye Bye
Thanks a lot for the snippet, works great. Was looking something like that for my project, you saved my time.
I'm trying to run this snippet but got the following Exception
Please help me:-
javax.servlet.ServletException: javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. u2sm14732770pbq.9
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.test_005fmail.send_jsp._jspService(send_jsp.java:133)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.vtr.globarena.URLCheckFilter.doFilter(URLCheckFilter.java:175)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
how can i run this program using commandprompt?
how to set paths for jar files?
pls help.
Provide me the jar files used
Hi Nagaraj,
Just include mail.jar in your classpath and you will be able to compile and run the program.
Just add acitvation.jar and mail.jar
Surely u will get Proper output
search for mail.jar and activation.jar