hello sir,
i am new to jsp and i have to use jsp mail in my project and i got a jsp mail script but unfortunately it is showing error like this one!
530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 f10sm3473193anh.25
i am using
smtp server:smtp.gmail.com
and there is no error except that i think it is connecting to smtp server because i tried by giveng a wrong server name and port,but i dont know what is authentication means...
here is my complete code
<%@ page language="java" import="javax.naming.*,java.io.*,javax.mail.*,
javax.mail.internet.*,com.sun.mail.smtp.*"%>
<html>
<head>
<title>Mail</title>
</head>
<body>
<%
try{
Session mailSession = Session.getInstance(System.getProperties());
Transport transport = new SMTPTransport(mailSession,new URLName("smtp.gmail.com"));
transport.connect("smtp.gmail.com",587,"xxx@gmail.com","xxx");
MimeMessage m = new MimeMessage(mailSession);
m.setFrom(new InternetAddress(%><%request.getParameter("from")%><%));
Address[] toAddr = new InternetAddress[] {
new InternetAddress(%><%request.getParameter("to")%><%)
};
m.setRecipients(javax.mail.Message.RecipientType.TO, toAddr );
m.setSubject(%><%request.getParameter("subject")%><%);
m.setSentDate(new java.util.Date());
m.setContent(%><%request.getParameter("description")%><%, "text/plain");
transport.sendMessage(m,m.getAllRecipients());
transport.close();
out.println("Thanks for sending mail!");
}
catch(Exception e){
out.println(e.getMessage());
e.printStackTrace();
}
%>
</body>
</html>
friends please help me as soon as possible..
thanking u all!!!