hello, Can anybody tell, what are all the basic things to be needed to develop automated mail using Java Mail API & JSP. As i already have jsp environment & Mail API jars i need steps in developing codes.
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Ajan Balakrishnan
Ranch Hand
Joined: Jan 04, 2001
Posts: 71
posted
0
You have to get the Java Mail(javamail-1.1.3), Java Activation (jaf-1.0.1) an pop3.1.1.1( if you want to receive mails) API's from sun's site. After extraction add the executable jar files mail.jar,activation.jar and pop3.jar(this depends) in your CLASSPATH. Now you need an SMTP to send the mail. Ask you ISP for this. Most cases it will be somthing like "smtp-server" followed by ".your isp domain name" . If you have you own SMTP server with a registered domain you can use that as well. This will do the job. I'm attaching a sample code here using servlets. It will be pretty same thing for JSP's. Just FYI , for sending attachments you have to use MultiMimePart class which comes along with Java Mail.This is not included in this sample but i can send you one if you want to. import java.io.IOException; import java.util.Properties; import javax.mail.* ; import javax.mail.internet.* ; import javax.servlet.*; import javax.servlet.http.*; public class WapMail extends HttpServlet {