Posted By:
Irfan_Mohiuddin
Posted On:
Tuesday, March 27, 2001 08:40 AM
I am new to java mail. I am getting an error.What could be the possible reasons for this error and what would be the possible solution.Thanks in advance. Error and code are given below: ERROR: "javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.SendFailedException: 554 : Recipient address rejected: Relay access denied" JSP CODE : <%@ pageimport=" javax.mail.*, javax.mail.internet.*, javax.activation.*,java.util.*" %> <% try{ Properties props = new Properties(); Sessio
More>>
I am new to java mail. I am getting an error.What could be the
possible
reasons for this error and what would be the possible solution.Thanks in advance. Error and code are given below:
ERROR:
"javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.SendFailedException: 554 : Recipient address rejected: Relay access denied"
JSP CODE :
<%@ pageimport=" javax.mail.*, javax.mail.internet.*, javax.activation.*,java.util.*"
%>
<%
try{
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;
sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "XX.X.X.X");
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress(request.getParameter("from")));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(request.getParameter("to")));
newMessage.setSubject(request.getParameter("subject"));
newMessage.setSentDate(new Date());
newMessage.setText(request.getParameter("text"));
transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
%>
Your mail has been sent.
<%
}
catch(MessagingException m)
{
out.println(m.toString());
}
%>
<<Less