Posts

Sending email in JAVA Servlet

Image
There are various ways to send email using JavaMail API. For this purpose, you must have SMTP server that is responsible for sending emails. We will be using the JavaMail API that provides all the classes required for sending an email. Use the SMTP server provided by the host provider e.g. my SMTP server is mail.java mail .com (or) Use the SMTP Server provided by other companies e.g. Gmail etc. For sending the email using JavaMail API, you need to load the two jar files:  java-mail.jar javax.activation.jar SMTP ( Simple Mail Transfer Protocol ): SMTP is an acronym for Simple Mail Transfer Protocol. It provides a mechanism to deliver the email. We can use Apache James server, Post cast server, claim server etc. as an SMTP server. But if we purchase the host space, an SMTP server is by default provided by the host provider. For example, my smut server is compartmentalization. If we use the SMTP server provided by the host provider, authentic

Email sending using Servlet

Image
In this example, we will see how to send an email in Servlet application. We will be using the  JavaMail  API that provides all the classes required for sending an email. JavaMail API encapsulates two important packages  javax.mail  and  javax.mail.internet . These packages provide classes that can be used to send and receive simple emails. You simply need an Internet connection to send email using this simple Application. Following the names of files to be created : Sent_Mail.java : Servlet java file which controls the request and response. It will invoke the send() method of Mail.java class that we have created to send the email. Mail.java : A java class that contains method to send mail. web.xml : In that give servlet name and url pattern. index.html : Will get the input from user. 1 ) Sent_Mail.java : 2 ) Mail.java: 3)web.xml : 4)index.html : Right click on mouse an